Project

General

Profile

Développement #44287

Compatibilité Python 3.8 C/API

Added by Benjamin Dauvergne over 4 years ago. Updated over 3 years ago.

Status:
Fermé
Priority:
Normal
Category:
-
Target version:
Start date:
19 June 2020
Due date:
% Done:

0%

Estimated time:
Patch proposed:
Yes
Planning:
No

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

0001-python-remove-unused-PyString_Size-44287.patch (972 Bytes) 0001-python-remove-unused-PyString_Size-44287.patch Benjamin Dauvergne, 19 June 2020 09:12 PM
0002-python-remove-deprecated-PyErr_Warn-44287.patch (2.93 KB) 0002-python-remove-deprecated-PyErr_Warn-44287.patch Benjamin Dauvergne, 19 June 2020 09:12 PM
0003-python-use-simpler-call-format-to-prevent-warning-ab.patch (900 Bytes) 0003-python-use-simpler-call-format-to-prevent-warning-ab.patch Benjamin Dauvergne, 19 June 2020 09:12 PM
0005-python-fix-warning-about-discarded-const-modifier-44.patch (1.67 KB) 0005-python-fix-warning-about-discarded-const-modifier-44.patch Benjamin Dauvergne, 19 June 2020 09:12 PM
0006-python-simplify-get_logger_object-44287.patch (1.87 KB) 0006-python-simplify-get_logger_object-44287.patch Benjamin Dauvergne, 19 June 2020 09:12 PM
0004-python-replace-exception-by-warning-on-logging-path-.patch (1.31 KB) 0004-python-replace-exception-by-warning-on-logging-path-.patch Benjamin Dauvergne, 19 June 2020 09:12 PM
0021-python-do-not-leak-out_pyvalue-if-method-call-protoc.patch (1.31 KB) 0021-python-do-not-leak-out_pyvalue-if-method-call-protoc.patch Benjamin Dauvergne, 20 June 2020 12:44 PM
0013-python-return-NULL-if-set_hashtable_of_strings-fails.patch (3.5 KB) 0013-python-return-NULL-if-set_hashtable_of_strings-fails.patch Benjamin Dauvergne, 20 June 2020 12:44 PM
0001-python-remove-unused-PyString_Size-44287.patch (974 Bytes) 0001-python-remove-unused-PyString_Size-44287.patch Benjamin Dauvergne, 20 June 2020 12:44 PM
0017-python-return-NULL-if-get_list_of_xml_nodes-fails-44.patch (766 Bytes) 0017-python-return-NULL-if-get_list_of_xml_nodes-fails-44.patch Benjamin Dauvergne, 20 June 2020 12:44 PM
0012-python-return-NULL-if-set_hashtable_of_pygobject-fai.patch (3.01 KB) 0012-python-return-NULL-if-set_hashtable_of_pygobject-fai.patch Benjamin Dauvergne, 20 June 2020 12:44 PM
0007-python-remove-newline-before-method-call-44287.patch (994 Bytes) 0007-python-remove-newline-before-method-call-44287.patch Benjamin Dauvergne, 20 June 2020 12:44 PM
0002-python-remove-deprecated-PyErr_Warn-44287.patch (2.93 KB) 0002-python-remove-deprecated-PyErr_Warn-44287.patch Benjamin Dauvergne, 20 June 2020 12:44 PM
0003-python-use-simpler-call-format-to-prevent-warning-ab.patch (902 Bytes) 0003-python-use-simpler-call-format-to-prevent-warning-ab.patch Benjamin Dauvergne, 20 June 2020 12:44 PM
0005-python-fix-warning-about-discarded-const-modifier-44.patch (1.68 KB) 0005-python-fix-warning-about-discarded-const-modifier-44.patch Benjamin Dauvergne, 20 June 2020 12:44 PM
0019-python-return-NULL-if-get_list_of_strings-fails-4428.patch (764 Bytes) 0019-python-return-NULL-if-get_list_of_strings-fails-4428.patch Benjamin Dauvergne, 20 June 2020 12:44 PM
0006-python-simplify-get_logger_object-44287.patch (1.87 KB) 0006-python-simplify-get_logger_object-44287.patch Benjamin Dauvergne, 20 June 2020 12:44 PM
0018-python-return-NULL-if-get_list_of_pygobject-fails-44.patch (752 Bytes) 0018-python-return-NULL-if-get_list_of_pygobject-fails-44.patch Benjamin Dauvergne, 20 June 2020 12:44 PM
0016-python-return-NULL-if-set_list_of_pygobject-fails-44.patch (4.22 KB) 0016-python-return-NULL-if-set_list_of_pygobject-fails-44.patch Benjamin Dauvergne, 20 June 2020 12:44 PM
0011-python-free-internal-string-buffer-if-needed-in-set_.patch (1.11 KB) 0011-python-free-internal-string-buffer-if-needed-in-set_.patch Benjamin Dauvergne, 20 June 2020 12:44 PM
0009-python-add-a-failure-label-to-method-wrappers-44287.patch (2.62 KB) 0009-python-add-a-failure-label-to-method-wrappers-44287.patch Benjamin Dauvergne, 20 June 2020 12:44 PM
0020-python-do-not-raise-in-valid_seq-44287.patch (758 Bytes) 0020-python-do-not-raise-in-valid_seq-44287.patch Benjamin Dauvergne, 20 June 2020 12:44 PM
0015-python-return-NULL-if-set_list_of_xml_nodes-fails-44.patch (3.75 KB) 0015-python-return-NULL-if-set_list_of_xml_nodes-fails-44.patch Benjamin Dauvergne, 20 June 2020 12:44 PM
0004-python-replace-exception-by-warning-on-logging-path-.patch (1.31 KB) 0004-python-replace-exception-by-warning-on-logging-path-.patch Benjamin Dauvergne, 20 June 2020 12:44 PM
0008-python-add-macro-for-early-return-44287.patch (715 Bytes) 0008-python-add-macro-for-early-return-44287.patch Benjamin Dauvergne, 20 June 2020 12:44 PM
0010-python-check-if-hashtable-is-NULL-before-deallocatio.patch (1000 Bytes) 0010-python-check-if-hashtable-is-NULL-before-deallocatio.patch Benjamin Dauvergne, 20 June 2020 12:44 PM
0014-python-return-NULL-if-set_list_of_strings-fails-4428.patch (4.02 KB) 0014-python-return-NULL-if-set_list_of_strings-fails-4428.patch Benjamin Dauvergne, 20 June 2020 12:44 PM

Associated revisions

Revision a1dbd489 (diff)
Added by Benjamin Dauvergne over 4 years ago

python: remove unused PyString_Size (#44287)

Revision 11bc68bb (diff)
Added by Benjamin Dauvergne over 4 years ago

python: remove deprecated PyErr_Warn (#44287)

Revision 8ae9d3a0 (diff)
Added by Benjamin Dauvergne over 4 years ago

python: use simpler call format to prevent warning about PY_SSIZE_T_CLEAN (#44287)

Revision 637514a8 (diff)
Added by Benjamin Dauvergne over 4 years ago

python: replace exception by warning on logging path (#44287)

Revision a8f82e67 (diff)
Added by Benjamin Dauvergne over 4 years ago

python: fix warning about discarded const modifier (#44287)

Revision 9db28c0c (diff)
Added by Benjamin Dauvergne over 4 years ago

python: simplify get_logger_object (#44287)

Revision 05dea2ea (diff)
Added by Benjamin Dauvergne over 4 years ago

python: remove newline before method call (#44287)

Revision 35682272 (diff)
Added by Benjamin Dauvergne over 4 years ago

python: add macro for early return (#44287)

Revision 0289da90 (diff)
Added by Benjamin Dauvergne over 4 years ago

python: add a failure label to method wrappers (#44287)

To separate wrapping code from unwinding and error handling code.

Revision f80b2bb5 (diff)
Added by Benjamin Dauvergne over 4 years ago

python: check if hashtable is NULL before deallocatio (#44287)n

Revision 85914512 (diff)
Added by Benjamin Dauvergne over 4 years ago

python: free internal string buffer if needed in set_list_of_strings (#44287)

Revision 57ee8d2f (diff)
Added by Benjamin Dauvergne over 4 years ago

python: return NULL if set_hashtable_of_pygobject fails (#44287)

Revision ed528ce2 (diff)
Added by Benjamin Dauvergne over 4 years ago

python: return NULL if set_hashtable_of_strings fails (#44287)

Revision c53b6b5a (diff)
Added by Benjamin Dauvergne over 4 years ago

python: return NULL if set_list_of_strings fails (#44287)

Revision c844abd8 (diff)
Added by Benjamin Dauvergne over 4 years ago

python: return NULL if set_list_of_xml_nodes fails (#44287)

Revision 4cf6bd4f (diff)
Added by Benjamin Dauvergne over 4 years ago

python: return NULL if set_list_of_pygobject fails (#44287)

Revision 6ed8e04f (diff)
Added by Benjamin Dauvergne over 4 years ago

python: return NULL if get_list_of_xml_nodes fails (#44287)

Revision 5f5bc888 (diff)
Added by Benjamin Dauvergne over 4 years ago

python: return NULL if get_list_of_pygobject fails (#44287)

Revision 77bed35c (diff)
Added by Benjamin Dauvergne over 4 years ago

python: return NULL if get_list_of_strings() fails (#44287)

Revision 4696e270 (diff)
Added by Benjamin Dauvergne over 4 years ago

python: do not raise in valid_seq() (#44287)

Revision 6c166563 (diff)
Added by Benjamin Dauvergne over 4 years ago

python: do not leak out_pyvalue if method call protocol is not respected (#44287)

Revision 0d0e5286 (diff)
Added by Benjamin Dauvergne over 4 years ago

jenkins.sh: build against all available python versions (#44287)

History

#2

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.

#3

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.

#4

Updated by Benjamin Dauvergne over 4 years ago

J'ai continué le boulot jusqu'au bout comme j'étais lancé.

#5

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 ?

#6

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.

#7

Updated by Benjamin Dauvergne over 4 years ago

  • Target version set to 2.6.2
#8

Updated by Benjamin Dauvergne over 4 years ago

Remarques de fred intégrées dans la branche.

#9

Updated by Frédéric Péters over 4 years ago

  • Status changed from Solution proposée to Solution validée

ok.

#10

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)
#11

Updated by Benjamin Dauvergne over 3 years ago

  • Status changed from Résolu (à déployer) to Fermé

Also available in: Atom PDF