Développement #44287
Compatibilité Python 3.8 C/API
0%
Description
Ça fait pas mal de trucs cracras que Python 3.8 n'aime pas du tout, comme poser une exception et retourner une valeur.
Aussi il semble que la façon de récupérer le logger python ne fonctionne plus (si on a pas importé "sys" d'abord les modules ne semblent plus accessibles).
Files
Associated revisions
python: remove deprecated PyErr_Warn (#44287)
python: use simpler call format to prevent warning about PY_SSIZE_T_CLEAN (#44287)
python: replace exception by warning on logging path (#44287)
python: fix warning about discarded const modifier (#44287)
python: simplify get_logger_object (#44287)
python: remove newline before method call (#44287)
python: add macro for early return (#44287)
python: add a failure label to method wrappers (#44287)
To separate wrapping code from unwinding and error handling code.
python: check if hashtable is NULL before deallocatio (#44287)n
python: free internal string buffer if needed in set_list_of_strings (#44287)
python: return NULL if set_hashtable_of_pygobject fails (#44287)
python: return NULL if set_hashtable_of_strings fails (#44287)
python: return NULL if set_list_of_strings fails (#44287)
python: return NULL if set_list_of_xml_nodes fails (#44287)
python: return NULL if set_list_of_pygobject fails (#44287)
python: return NULL if get_list_of_xml_nodes fails (#44287)
python: return NULL if get_list_of_pygobject fails (#44287)
python: return NULL if get_list_of_strings() fails (#44287)
python: do not raise in valid_seq() (#44287)
python: do not leak out_pyvalue if method call protocol is not respected (#44287)
jenkins.sh: build against all available python versions (#44287)
History
Updated by Benjamin Dauvergne over 4 years ago
- File 0001-python-remove-unused-PyString_Size-44287.patch 0001-python-remove-unused-PyString_Size-44287.patch added
- File 0002-python-remove-deprecated-PyErr_Warn-44287.patch 0002-python-remove-deprecated-PyErr_Warn-44287.patch added
- File 0003-python-use-simpler-call-format-to-prevent-warning-ab.patch 0003-python-use-simpler-call-format-to-prevent-warning-ab.patch added
- File 0005-python-fix-warning-about-discarded-const-modifier-44.patch 0005-python-fix-warning-about-discarded-const-modifier-44.patch added
- File 0006-python-simplify-get_logger_object-44287.patch 0006-python-simplify-get_logger_object-44287.patch added
- File 0004-python-replace-exception-by-warning-on-logging-path-.patch 0004-python-replace-exception-by-warning-on-logging-path-.patch added
- Status changed from Nouveau to Solution proposée
- Patch proposed changed from No to Yes
Voilà si ça passionne des gens, il faudrait relire.
Updated by Frédéric Péters over 4 years ago
Ça fait pas mal de trucs cracras que Python 3.8 n'aime pas du tout.
Ça a quelles conséquences concrètes ? (parce que dans Debian on a python 3.8 et lasso et je tourne dans cet environnement sans soucis).
Il y a dans la branche un "debian: make a generic debian directory" qui commence par modifier le Jenkinsfile pour explicitement pointer stretch,buster plutôt que laisser la valeur par défaut à eobuilder, alors qu'on a plutôt eu la direction inverse.
À part ça je relirai plus attentivement lundi.
Updated by Benjamin Dauvergne over 4 years ago
Frédéric Péters a écrit :
Ça fait pas mal de trucs cracras que Python 3.8 n'aime pas du tout.
Ça a quelles conséquences concrètes ? (parce que dans Debian on a python 3.8 et lasso et je tourne dans cet environnement sans soucis).
Ma config devait être dans un état particulier, mais PyImport_ImportModule("lasso") et PyImport_ImportModule("logging") foiraient sans raison.
Ça provoquait des levées d'exception dans le code via PyErr_SetString() (et il en reste encore) qui était ignorée ensuite par l'implémentation des méthodes et ça crashait avec un message "SystemError: login_process_process_authn_request_msg returned a result with an error set” in Python"; l'API C de Python interdit de continuer normalement lorsqu'une exception a été levée ou alors il faut la nettoyer via PyErr_Clear().
Au passage j'ai vu ce commentaire zarbi sur la nécessite d'importer "sys" avant d'importer "logging" que je n'ai vu nulle part ailleurs alors je l'ai viré et j'ai réécrit le code plus proprement, en évitant de réutiliser la variable "logging_module" pour tout.
Pour PyErr_Warn j'ai vu passé le warning de dépréciation au passage; quand aux corrections autour du modificateur "const" sur le retour PyString_AsString" c'est des warnings que je n'avais pas trop regardé mais ça cachait des utilisations de références invalides :
- char *ckey = PyString_AsString(key); - g_hash_table_replace (a_hash, ckey, ((PyGObjectPtr*)value)->obj);
ici ckey pointe sur un buffer appartenant à la chaîne python "key" on a pas du tout le droit de l'insérer dans la hashtable (ça tombe bien on utilise quasiment jamais les hashtable dans Lasso, mais bon).
Il y a dans la branche un "debian: make a generic debian directory" qui commence par modifier le Jenkinsfile pour explicitement pointer stretch,buster plutôt que laisser la valeur par défaut à eobuilder, alors qu'on a plutôt eu la direction inverse.
Je vais le virer ça devait traîner sur mon master (c'est fait branche à jour).
À part ça je relirai plus attentivement lundi.
Ok.
Updated by Benjamin Dauvergne over 4 years ago
- File 0021-python-do-not-leak-out_pyvalue-if-method-call-protoc.patch 0021-python-do-not-leak-out_pyvalue-if-method-call-protoc.patch added
- File 0013-python-return-NULL-if-set_hashtable_of_strings-fails.patch 0013-python-return-NULL-if-set_hashtable_of_strings-fails.patch added
- File 0001-python-remove-unused-PyString_Size-44287.patch 0001-python-remove-unused-PyString_Size-44287.patch added
- File 0017-python-return-NULL-if-get_list_of_xml_nodes-fails-44.patch 0017-python-return-NULL-if-get_list_of_xml_nodes-fails-44.patch added
- File 0012-python-return-NULL-if-set_hashtable_of_pygobject-fai.patch 0012-python-return-NULL-if-set_hashtable_of_pygobject-fai.patch added
- File 0007-python-remove-newline-before-method-call-44287.patch 0007-python-remove-newline-before-method-call-44287.patch added
- File 0002-python-remove-deprecated-PyErr_Warn-44287.patch 0002-python-remove-deprecated-PyErr_Warn-44287.patch added
- File 0003-python-use-simpler-call-format-to-prevent-warning-ab.patch 0003-python-use-simpler-call-format-to-prevent-warning-ab.patch added
- File 0005-python-fix-warning-about-discarded-const-modifier-44.patch 0005-python-fix-warning-about-discarded-const-modifier-44.patch added
- File 0019-python-return-NULL-if-get_list_of_strings-fails-4428.patch 0019-python-return-NULL-if-get_list_of_strings-fails-4428.patch added
- File 0006-python-simplify-get_logger_object-44287.patch 0006-python-simplify-get_logger_object-44287.patch added
- File 0018-python-return-NULL-if-get_list_of_pygobject-fails-44.patch 0018-python-return-NULL-if-get_list_of_pygobject-fails-44.patch added
- File 0016-python-return-NULL-if-set_list_of_pygobject-fails-44.patch 0016-python-return-NULL-if-set_list_of_pygobject-fails-44.patch added
- File 0011-python-free-internal-string-buffer-if-needed-in-set_.patch 0011-python-free-internal-string-buffer-if-needed-in-set_.patch added
- File 0009-python-add-a-failure-label-to-method-wrappers-44287.patch 0009-python-add-a-failure-label-to-method-wrappers-44287.patch added
- File 0020-python-do-not-raise-in-valid_seq-44287.patch 0020-python-do-not-raise-in-valid_seq-44287.patch added
- File 0015-python-return-NULL-if-set_list_of_xml_nodes-fails-44.patch 0015-python-return-NULL-if-set_list_of_xml_nodes-fails-44.patch added
- File 0004-python-replace-exception-by-warning-on-logging-path-.patch 0004-python-replace-exception-by-warning-on-logging-path-.patch added
- File 0008-python-add-macro-for-early-return-44287.patch 0008-python-add-macro-for-early-return-44287.patch added
- File 0010-python-check-if-hashtable-is-NULL-before-deallocatio.patch 0010-python-check-if-hashtable-is-NULL-before-deallocatio.patch added
- File 0014-python-return-NULL-if-set_list_of_strings-fails-4428.patch 0014-python-return-NULL-if-set_list_of_strings-fails-4428.patch added
J'ai continué le boulot jusqu'au bout comme j'étais lancé.
Updated by Frédéric Péters over 4 years ago
Le "debian: make a generic debian directory" qui est dans la branche mais pas listé ci-dessus est quelque chose d'assez pénible pour une intégration officielle dans Debian, je préférerais qu'on garde le répertoire sur le côté. (et s'il faut on peut faire évoluer eobuilder pour qu'il prenne un debian-generic/ en l'absence de debian-$dist/).
-static void +int
C'est nécessaire, ou sans conséquence parce que flag quelconque passé lors du build, de perdre le static ?
Updated by Benjamin Dauvergne over 4 years ago
Frédéric Péters a écrit :
Le "debian: make a generic debian directory" qui est dans la branche mais pas listé ci-dessus est quelque chose d'assez pénible pour une intégration officielle dans Debian, je préférerais qu'on garde le répertoire sur le côté. (et s'il faut on peut faire évoluer eobuilder pour qu'il prenne un debian-generic/ en l'absence de debian-$dist/).
Ok, j'ai copier debian-stretch sur debian-buster en lieu et place, on verra debian-generic un autre jour.
C'est nécessaire, ou sans conséquence parce que flag quelconque passé lors du build, de perdre le static ?
Je parle sans connaître ce que dit la norme C exactement mais j'ai l'impression qu'oublier un flag de link à la définition n'a pas d'effet que c'est la première déclaration qui compte, parce que je ne vois ni erreur ni warning, néanmoins je les ai remis parce que c'est plus cohérent et pas fait exprès.
Updated by Frédéric Péters over 4 years ago
- Status changed from Solution proposée to Solution validée
ok.
Updated by Benjamin Dauvergne over 4 years ago
- Status changed from Solution validée to Résolu (à déployer)
commit 0d0e5286a7884a58023b69b905e2b3a8fd1f73d1 Author: Benjamin Dauvergne <bdauvergne@entrouvert.com> Date: Sat Jun 20 13:53:11 2020 +0200 jenkins.sh: build against all available python versions (#44287) commit 6c166563b25bd828ef6501d23ba6fbf101d37b19 Author: Benjamin Dauvergne <bdauvergne@entrouvert.com> Date: Sat Jun 20 09:16:22 2020 +0200 python: do not leak out_pyvalue if method call protocol is not respected (#44287) commit 4696e2709b04aff284b1c78d600153de4febb61f Author: Benjamin Dauvergne <bdauvergne@entrouvert.com> Date: Sat Jun 20 07:26:17 2020 +0200 python: do not raise in valid_seq() (#44287) commit 77bed35c426136a034f4d98f8effd8fffcc4ccc5 Author: Benjamin Dauvergne <bdauvergne@entrouvert.com> Date: Sat Jun 20 09:17:56 2020 +0200 python: return NULL if get_list_of_strings() fails (#44287) commit 5f5bc888b165f9c81331168c28727aceb3200644 Author: Benjamin Dauvergne <bdauvergne@entrouvert.com> Date: Sat Jun 20 12:27:54 2020 +0200 python: return NULL if get_list_of_pygobject fails (#44287) commit 6ed8e04ff114d319f2c2dd33bbd3e0193e5d7462 Author: Benjamin Dauvergne <bdauvergne@entrouvert.com> Date: Sat Jun 20 12:25:21 2020 +0200 python: return NULL if get_list_of_xml_nodes fails (#44287) commit 4cf6bd4ff7d68f4b19bc7260e1d04532412c82f1 Author: Benjamin Dauvergne <bdauvergne@entrouvert.com> Date: Sat Jun 20 08:33:35 2020 +0200 python: return NULL if set_list_of_pygobject fails (#44287) commit c844abd8e46269c563321c085ba47b5aefc7dcce Author: Benjamin Dauvergne <bdauvergne@entrouvert.com> Date: Sat Jun 20 08:18:30 2020 +0200 python: return NULL if set_list_of_xml_nodes fails (#44287) commit c53b6b5a7377892c4302b55f5422b81fbcb77be6 Author: Benjamin Dauvergne <bdauvergne@entrouvert.com> Date: Sat Jun 20 07:59:49 2020 +0200 python: return NULL if set_list_of_strings fails (#44287) commit ed528ce26ac3842148b3c3cc4e9580a6cd860200 Author: Benjamin Dauvergne <bdauvergne@entrouvert.com> Date: Sat Jun 20 07:36:23 2020 +0200 python: return NULL if set_hashtable_of_strings fails (#44287) commit 57ee8d2f2a6566c997cb1c5e0054fdd1c62e1094 Author: Benjamin Dauvergne <bdauvergne@entrouvert.com> Date: Sat Jun 20 07:32:09 2020 +0200 python: return NULL if set_hashtable_of_pygobject fails (#44287) commit 8591451270b0ef550add12c2cb51407287bae146 Author: Benjamin Dauvergne <bdauvergne@entrouvert.com> Date: Sat Jun 20 08:12:05 2020 +0200 python: free internal string buffer if needed in set_list_of_strings (#44287) commit f80b2bb50ed6060b99f3d8f9abd25589c2ca08cb Author: Benjamin Dauvergne <bdauvergne@entrouvert.com> Date: Sat Jun 20 08:04:25 2020 +0200 python: check if hashtable is NULL before deallocatio (#44287)n commit 0289da907f8ef3558a9ff553b0e19ed60fdb37b8 Author: Benjamin Dauvergne <bdauvergne@entrouvert.com> Date: Sat Jun 20 12:33:39 2020 +0200 python: add a failure label to method wrappers (#44287) To separate wrapping code from unwinding and error handling code. commit 35682272ece5fbc02cdf06fc0032714f7fa1dbdd Author: Benjamin Dauvergne <bdauvergne@entrouvert.com> Date: Sat Jun 20 08:07:22 2020 +0200 python: add macro for early return (#44287) commit 05dea2eab5813a1b539ae20608a37ae6ecfe0034 Author: Benjamin Dauvergne <bdauvergne@entrouvert.com> Date: Sat Jun 20 08:04:55 2020 +0200 python: remove newline before method call (#44287) commit 9db28c0c32bbeddca42de831f20273d2675a69c5 Author: Benjamin Dauvergne <bdauvergne@entrouvert.com> Date: Fri Jun 19 21:08:14 2020 +0200 python: simplify get_logger_object (#44287) commit a8f82e67efb28a36f3a78350566b213f895e5c40 Author: Benjamin Dauvergne <bdauvergne@entrouvert.com> Date: Fri Jun 19 21:06:11 2020 +0200 python: fix warning about discarded const modifier (#44287) commit 637514a874885dcb67efb93f1b9c640f9c899873 Author: Benjamin Dauvergne <bdauvergne@entrouvert.com> Date: Fri Jun 19 21:05:23 2020 +0200 python: replace exception by warning on logging path (#44287) commit 8ae9d3a09b35fb15b047ff3d2c92535d9ce32697 Author: Benjamin Dauvergne <bdauvergne@entrouvert.com> Date: Fri Jun 19 21:04:59 2020 +0200 python: use simpler call format to prevent warning about PY_SSIZE_T_CLEAN (#44287) commit 11bc68bbbcf223efdc40a82136595067c49123bb Author: Benjamin Dauvergne <bdauvergne@entrouvert.com> Date: Fri Jun 19 21:02:56 2020 +0200 python: remove deprecated PyErr_Warn (#44287) commit a1dbd489fc5f393d97b21e84eb129f94ca08063b Author: Benjamin Dauvergne <bdauvergne@entrouvert.com> Date: Fri Jun 19 21:02:25 2020 +0200 python: remove unused PyString_Size (#44287)
python: remove unused PyString_Size (#44287)