Projet

Général

Profil

Development #44287

Compatibilité Python 3.8 C/API

Ajouté par Benjamin Dauvergne il y a presque 4 ans. Mis à jour il y a plus de 2 ans.

Statut:
Fermé
Priorité:
Normal
Assigné à:
Catégorie:
-
Version cible:
Début:
19 juin 2020
Echéance:
% réalisé:

0%

Temps estimé:
Patch proposed:
Oui
Planning:
Non

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).


Fichiers

0001-python-remove-unused-PyString_Size-44287.patch (972 octets) 0001-python-remove-unused-PyString_Size-44287.patch Benjamin Dauvergne, 19 juin 2020 21:12
0002-python-remove-deprecated-PyErr_Warn-44287.patch (2,93 ko) 0002-python-remove-deprecated-PyErr_Warn-44287.patch Benjamin Dauvergne, 19 juin 2020 21:12
0003-python-use-simpler-call-format-to-prevent-warning-ab.patch (900 octets) 0003-python-use-simpler-call-format-to-prevent-warning-ab.patch Benjamin Dauvergne, 19 juin 2020 21:12
0005-python-fix-warning-about-discarded-const-modifier-44.patch (1,67 ko) 0005-python-fix-warning-about-discarded-const-modifier-44.patch Benjamin Dauvergne, 19 juin 2020 21:12
0006-python-simplify-get_logger_object-44287.patch (1,87 ko) 0006-python-simplify-get_logger_object-44287.patch Benjamin Dauvergne, 19 juin 2020 21:12
0004-python-replace-exception-by-warning-on-logging-path-.patch (1,31 ko) 0004-python-replace-exception-by-warning-on-logging-path-.patch Benjamin Dauvergne, 19 juin 2020 21:12
0021-python-do-not-leak-out_pyvalue-if-method-call-protoc.patch (1,31 ko) 0021-python-do-not-leak-out_pyvalue-if-method-call-protoc.patch Benjamin Dauvergne, 20 juin 2020 12:44
0013-python-return-NULL-if-set_hashtable_of_strings-fails.patch (3,5 ko) 0013-python-return-NULL-if-set_hashtable_of_strings-fails.patch Benjamin Dauvergne, 20 juin 2020 12:44
0001-python-remove-unused-PyString_Size-44287.patch (974 octets) 0001-python-remove-unused-PyString_Size-44287.patch Benjamin Dauvergne, 20 juin 2020 12:44
0017-python-return-NULL-if-get_list_of_xml_nodes-fails-44.patch (766 octets) 0017-python-return-NULL-if-get_list_of_xml_nodes-fails-44.patch Benjamin Dauvergne, 20 juin 2020 12:44
0012-python-return-NULL-if-set_hashtable_of_pygobject-fai.patch (3,01 ko) 0012-python-return-NULL-if-set_hashtable_of_pygobject-fai.patch Benjamin Dauvergne, 20 juin 2020 12:44
0007-python-remove-newline-before-method-call-44287.patch (994 octets) 0007-python-remove-newline-before-method-call-44287.patch Benjamin Dauvergne, 20 juin 2020 12:44
0002-python-remove-deprecated-PyErr_Warn-44287.patch (2,93 ko) 0002-python-remove-deprecated-PyErr_Warn-44287.patch Benjamin Dauvergne, 20 juin 2020 12:44
0003-python-use-simpler-call-format-to-prevent-warning-ab.patch (902 octets) 0003-python-use-simpler-call-format-to-prevent-warning-ab.patch Benjamin Dauvergne, 20 juin 2020 12:44
0005-python-fix-warning-about-discarded-const-modifier-44.patch (1,68 ko) 0005-python-fix-warning-about-discarded-const-modifier-44.patch Benjamin Dauvergne, 20 juin 2020 12:44
0019-python-return-NULL-if-get_list_of_strings-fails-4428.patch (764 octets) 0019-python-return-NULL-if-get_list_of_strings-fails-4428.patch Benjamin Dauvergne, 20 juin 2020 12:44
0006-python-simplify-get_logger_object-44287.patch (1,87 ko) 0006-python-simplify-get_logger_object-44287.patch Benjamin Dauvergne, 20 juin 2020 12:44
0018-python-return-NULL-if-get_list_of_pygobject-fails-44.patch (752 octets) 0018-python-return-NULL-if-get_list_of_pygobject-fails-44.patch Benjamin Dauvergne, 20 juin 2020 12:44
0016-python-return-NULL-if-set_list_of_pygobject-fails-44.patch (4,22 ko) 0016-python-return-NULL-if-set_list_of_pygobject-fails-44.patch Benjamin Dauvergne, 20 juin 2020 12:44
0011-python-free-internal-string-buffer-if-needed-in-set_.patch (1,11 ko) 0011-python-free-internal-string-buffer-if-needed-in-set_.patch Benjamin Dauvergne, 20 juin 2020 12:44
0009-python-add-a-failure-label-to-method-wrappers-44287.patch (2,62 ko) 0009-python-add-a-failure-label-to-method-wrappers-44287.patch Benjamin Dauvergne, 20 juin 2020 12:44
0020-python-do-not-raise-in-valid_seq-44287.patch (758 octets) 0020-python-do-not-raise-in-valid_seq-44287.patch Benjamin Dauvergne, 20 juin 2020 12:44
0015-python-return-NULL-if-set_list_of_xml_nodes-fails-44.patch (3,75 ko) 0015-python-return-NULL-if-set_list_of_xml_nodes-fails-44.patch Benjamin Dauvergne, 20 juin 2020 12:44
0004-python-replace-exception-by-warning-on-logging-path-.patch (1,31 ko) 0004-python-replace-exception-by-warning-on-logging-path-.patch Benjamin Dauvergne, 20 juin 2020 12:44
0008-python-add-macro-for-early-return-44287.patch (715 octets) 0008-python-add-macro-for-early-return-44287.patch Benjamin Dauvergne, 20 juin 2020 12:44
0010-python-check-if-hashtable-is-NULL-before-deallocatio.patch (1000 octets) 0010-python-check-if-hashtable-is-NULL-before-deallocatio.patch Benjamin Dauvergne, 20 juin 2020 12:44
0014-python-return-NULL-if-set_list_of_strings-fails-4428.patch (4,02 ko) 0014-python-return-NULL-if-set_list_of_strings-fails-4428.patch Benjamin Dauvergne, 20 juin 2020 12:44

Révisions associées

Révision a1dbd489 (diff)
Ajouté par Benjamin Dauvergne il y a plus de 3 ans

python: remove unused PyString_Size (#44287)

Révision 11bc68bb (diff)
Ajouté par Benjamin Dauvergne il y a plus de 3 ans

python: remove deprecated PyErr_Warn (#44287)

Révision 8ae9d3a0 (diff)
Ajouté par Benjamin Dauvergne il y a plus de 3 ans

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

Révision 637514a8 (diff)
Ajouté par Benjamin Dauvergne il y a plus de 3 ans

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

Révision a8f82e67 (diff)
Ajouté par Benjamin Dauvergne il y a plus de 3 ans

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

Révision 9db28c0c (diff)
Ajouté par Benjamin Dauvergne il y a plus de 3 ans

python: simplify get_logger_object (#44287)

Révision 05dea2ea (diff)
Ajouté par Benjamin Dauvergne il y a plus de 3 ans

python: remove newline before method call (#44287)

Révision 35682272 (diff)
Ajouté par Benjamin Dauvergne il y a plus de 3 ans

python: add macro for early return (#44287)

Révision 0289da90 (diff)
Ajouté par Benjamin Dauvergne il y a plus de 3 ans

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

To separate wrapping code from unwinding and error handling code.

Révision f80b2bb5 (diff)
Ajouté par Benjamin Dauvergne il y a plus de 3 ans

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

Révision 85914512 (diff)
Ajouté par Benjamin Dauvergne il y a plus de 3 ans

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

Révision 57ee8d2f (diff)
Ajouté par Benjamin Dauvergne il y a plus de 3 ans

python: return NULL if set_hashtable_of_pygobject fails (#44287)

Révision ed528ce2 (diff)
Ajouté par Benjamin Dauvergne il y a plus de 3 ans

python: return NULL if set_hashtable_of_strings fails (#44287)

Révision c53b6b5a (diff)
Ajouté par Benjamin Dauvergne il y a plus de 3 ans

python: return NULL if set_list_of_strings fails (#44287)

Révision c844abd8 (diff)
Ajouté par Benjamin Dauvergne il y a plus de 3 ans

python: return NULL if set_list_of_xml_nodes fails (#44287)

Révision 4cf6bd4f (diff)
Ajouté par Benjamin Dauvergne il y a plus de 3 ans

python: return NULL if set_list_of_pygobject fails (#44287)

Révision 6ed8e04f (diff)
Ajouté par Benjamin Dauvergne il y a plus de 3 ans

python: return NULL if get_list_of_xml_nodes fails (#44287)

Révision 5f5bc888 (diff)
Ajouté par Benjamin Dauvergne il y a plus de 3 ans

python: return NULL if get_list_of_pygobject fails (#44287)

Révision 77bed35c (diff)
Ajouté par Benjamin Dauvergne il y a plus de 3 ans

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

Révision 4696e270 (diff)
Ajouté par Benjamin Dauvergne il y a plus de 3 ans

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

Révision 6c166563 (diff)
Ajouté par Benjamin Dauvergne il y a plus de 3 ans

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

Révision 0d0e5286 (diff)
Ajouté par Benjamin Dauvergne il y a plus de 3 ans

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

Historique

#2

Mis à jour par Frédéric Péters il y a presque 4 ans

Ç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

Mis à jour par Benjamin Dauvergne il y a presque 4 ans

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

Mis à jour par Benjamin Dauvergne il y a presque 4 ans

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

#5

Mis à jour par Frédéric Péters il y a presque 4 ans

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

Mis à jour par Benjamin Dauvergne il y a plus de 3 ans

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

Mis à jour par Benjamin Dauvergne il y a plus de 3 ans

  • Version cible mis à 2.6.2
#8

Mis à jour par Benjamin Dauvergne il y a plus de 3 ans

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

#9

Mis à jour par Frédéric Péters il y a plus de 3 ans

  • Statut changé de Solution proposée à Solution validée

ok.

#10

Mis à jour par Benjamin Dauvergne il y a plus de 3 ans

  • Statut changé de Solution validée à 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

Mis à jour par Benjamin Dauvergne il y a plus de 2 ans

  • Statut changé de Résolu (à déployer) à Fermé

Formats disponibles : Atom PDF