Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
cc6e87b2
Commit
cc6e87b2
authored
Nov 30, 2013
by
Alexandre Vassalotti
Browse files
Options
Browse Files
Download
Plain Diff
Issue #19088: Merge with 3.3.
parents
8ddd59e8
1a83070d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
17 deletions
+23
-17
Misc/NEWS
Misc/NEWS
+3
-0
Objects/typeobject.c
Objects/typeobject.c
+20
-17
No files found.
Misc/NEWS
View file @
cc6e87b2
...
@@ -22,6 +22,9 @@ Library
...
@@ -22,6 +22,9 @@ Library
constructor is given a str. Move the array module typecode documentation to
constructor is given a str. Move the array module typecode documentation to
the docstring of the constructor.
the docstring of the constructor.
- Issue #19088: Fixed incorrect caching of the copyreg module in
object.__reduce__() and object.__reduce_ex__().
- Issue #19698: Removed exec_module() methods from
- Issue #19698: Removed exec_module() methods from
importlib.machinery.BuiltinImporter and ExtensionFileLoader.
importlib.machinery.BuiltinImporter and ExtensionFileLoader.
...
...
Objects/typeobject.c
View file @
cc6e87b2
...
@@ -7,10 +7,6 @@
...
@@ -7,10 +7,6 @@
#include <ctype.h>
#include <ctype.h>
/* Cached lookup of the copyreg module, for faster __reduce__ calls */
static
PyObject
*
cached_copyreg_module
=
NULL
;
/* Support type attribute cache */
/* Support type attribute cache */
/* The cache can keep references to the names alive for longer than
/* The cache can keep references to the names alive for longer than
...
@@ -79,9 +75,6 @@ void
...
@@ -79,9 +75,6 @@ void
_PyType_Fini
(
void
)
_PyType_Fini
(
void
)
{
{
PyType_ClearCache
();
PyType_ClearCache
();
/* Need to forget our obsolete instance of the copyreg module at
* interpreter shutdown (issue #17408). */
Py_CLEAR
(
cached_copyreg_module
);
}
}
void
void
...
@@ -3390,19 +3383,29 @@ static PyGetSetDef object_getsets[] = {
...
@@ -3390,19 +3383,29 @@ static PyGetSetDef object_getsets[] = {
static
PyObject
*
static
PyObject
*
import_copyreg
(
void
)
import_copyreg
(
void
)
{
{
static
PyObject
*
copyreg_str
;
PyObject
*
copyreg_str
;
PyObject
*
copyreg_module
;
PyInterpreterState
*
interp
=
PyThreadState_GET
()
->
interp
;
_Py_IDENTIFIER
(
copyreg
);
if
(
!
copyreg_str
)
{
copyreg_str
=
_PyUnicode_FromId
(
&
PyId_copyreg
);
copyreg_str
=
PyUnicode_InternFromString
(
"copyreg"
);
if
(
copyreg_str
==
NULL
)
{
if
(
copyreg_str
==
NULL
)
return
NULL
;
return
NULL
;
}
}
if
(
!
cached_copyreg_module
)
{
/* Try to fetch cached copy of copyreg from sys.modules first in an
cached_copyreg_module
=
PyImport_Import
(
copyreg_str
);
attempt to avoid the import overhead. Previously this was implemented
by storing a reference to the cached module in a static variable, but
this broke when multiple embeded interpreters were in use (see issue
#17408 and #19088). */
copyreg_module
=
PyDict_GetItemWithError
(
interp
->
modules
,
copyreg_str
);
if
(
copyreg_module
!=
NULL
)
{
Py_INCREF
(
copyreg_module
);
return
copyreg_module
;
}
if
(
PyErr_Occurred
())
{
return
NULL
;
}
}
return
PyImport_Import
(
copyreg_str
);
Py_XINCREF
(
cached_copyreg_module
);
return
cached_copyreg_module
;
}
}
Py_LOCAL
(
PyObject
*
)
Py_LOCAL
(
PyObject
*
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment