This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: PEP 384 Refactoring applied to json module
Type: resource usage Stage: resolved
Components: Extension Modules Versions: Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Robin.Schreiber, asvetlov, corona10, loewis, vstinner
Priority: normal Keywords: pep3121

Created on 2012-08-14 18:53 by Robin.Schreiber, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
_json_pep384_v0.patch Robin.Schreiber, 2012-08-14 18:53
_json_pep384_v1.patch Robin.Schreiber, 2012-08-15 09:00
Messages (6)
msg168222 - (view) Author: Robin Schreiber (Robin.Schreiber) * (Python triager) Date: 2012-08-14 18:53
Changes proposed in PEP3121 and PEP384 have now been applied to the json module!
msg168227 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-08-14 19:03
+    // in case init is called multiple times within one interpreter,
+    // we do not have to repeat all of the initialization

First, you shouldn't use C++-style comments ("//").
Second, I find this comment a bit weird. Even if init is called a second time, surely clear would have been called in-between, and therefore the module state has to be initialized again?

Review comments from issue15653 also apply here.
msg168236 - (view) Author: Robin Schreiber (Robin.Schreiber) * (Python triager) Date: 2012-08-14 19:50
Hey Antoine,

This comment describes exactly what I intended with the "dance" in issue15653. For example the json testsuite issued multiple calls to the init function before unloading and consequently clearing the module.
However it seems as if the behavior this code dealt with,
has been a bug inside the import lib.
msg168238 - (view) Author: Robin Schreiber (Robin.Schreiber) * (Python triager) Date: 2012-08-14 19:57
Incidentally, I am deeply sorry for the C++-Style comments. I thought those would be detected by the patchcheck.py.
msg168267 - (view) Author: Robin Schreiber (Robin.Schreiber) * (Python triager) Date: 2012-08-15 09:00
Removed C++ comment and corresponding codesnipped. Also changed bad-style macro definition.
msg372060 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-06-22 09:20
Issue fixed in Python 3.9 with:

commit 33f15a16d40cb8010a8c758952cbf88d7912ee2d
Author: Dong-hee Na <donghee.na92@gmail.com>
Date:   Fri Mar 27 19:59:59 2020 +0900

    bpo-40077: Convert _json module to use PyType_FromSpec() (GH-19177)
    
    Replace statically allocated types with heap allocated types:
    use PyType_FromSpec().
    
    Add a module state to store the Scanner and Encoder types.
    Add traverse, clear and free functions to the module.
History
Date User Action Args
2022-04-11 14:57:34adminsetgithub: 59860
2020-06-22 09:21:01pitrousetnosy: - pitrou
2020-06-22 09:20:19vstinnersetstatus: open -> closed

versions: + Python 3.9, - Python 3.4
nosy: + corona10, vstinner

messages: + msg372060
resolution: fixed
stage: resolved
2012-11-08 13:38:22Robin.Schreibersetkeywords: + pep3121, - patch
2012-08-17 16:37:55asvetlovsetnosy: + asvetlov
2012-08-15 09:00:50Robin.Schreibersetfiles: + _json_pep384_v1.patch

messages: + msg168267
2012-08-14 19:57:46Robin.Schreibersetmessages: + msg168238
2012-08-14 19:50:26Robin.Schreibersetmessages: + msg168236
2012-08-14 19:03:22pitrousetnosy: + loewis, pitrou
messages: + msg168227
2012-08-14 18:53:17Robin.Schreibercreate