summaryrefslogtreecommitdiffstats
path: root/Objects/moduleobject.c
Commit message (Collapse)AuthorAgeFilesLines
* bpo-31492: Fix assertion failures in case of a module with a bad __name__ ↵Oren Milman2017-09-191-4/+1
| | | | attribute. (#3620)
* bpo-28411: Isolate PyInterpreterState.modules (#3575)Eric Snow2017-09-141-3/+9
| | | | | A bunch of code currently uses PyInterpreterState.modules directly instead of PyImport_GetModuleDict(). This complicates efforts to make changes relative to sys.modules. This patch switches to using PyImport_GetModuleDict() uniformly. Also, a number of related uses of sys.modules are updated for uniformity for the same reason. Note that this code was already reviewed and merged as part of #1638. I reverted that and am now splitting it up into more focused parts.
* bpo-31404: Revert "remove modules from Py_InterpreterState (#1638)" (#3565)Eric Snow2017-09-141-9/+3
| | | PR #1638, for bpo-28411, causes problems in some (very) edge cases. Until that gets sorted out, we're reverting the merge. PR #3506, a fix on top of #1638, is also getting reverted.
* bpo-30860: Consolidate stateful runtime globals. (#3397)Eric Snow2017-09-081-0/+1
| | | | | | | * group the (stateful) runtime globals into various topical structs * consolidate the topical structs under a single top-level _PyRuntimeState struct * add a check-c-globals.py script that helps identify runtime globals Other globals are excluded (see globals.txt and check-c-globals.py).
* bpo-28411: Remove "modules" field from Py_InterpreterState. (#1638)Eric Snow2017-09-041-3/+9
| | | sys.modules is the one true source.
* bpo-29793: Convert some builtin types constructors to Argument Clinic. (#615)Serhiy Storchaka2017-03-191-17/+24
|
* Issue #28748: Private variable _Py_PackageContext is now of type "const char *"Serhiy Storchaka2016-11-211-1/+1
| | | | rather of "char *".
* Added the const qualifier to char* variables that refer to readonly internalSerhiy Storchaka2016-11-201-2/+2
| | | | UTF-8 represenatation of Unicode objects.
* Replaced outdated macros _PyUnicode_AsString and _PyUnicode_AsStringAndSizeSerhiy Storchaka2016-11-201-4/+4
| | | | with PyUnicode_AsUTF8 and PyUnicode_AsUTF8AndSize.
* Issue #28701: Replace PyUnicode_CompareWithASCIIString with ↵Serhiy Storchaka2016-11-161-1/+1
|\ | | | | | | | | | | _PyUnicode_EqualToASCIIString. The latter function is more readable, faster and doesn't raise exceptions.
| * Issue #28701: Replace PyUnicode_CompareWithASCIIString with ↵Serhiy Storchaka2016-11-161-1/+1
| | | | | | | | | | | | _PyUnicode_EqualToASCIIString. The latter function is more readable, faster and doesn't raise exceptions.
* | Issue #27914: Fixed a comment in PyModule_ExcDef.Serhiy Storchaka2016-09-261-1/+1
| | | | | | | | Patch by Xiang Zhang.
* | Merge #27782 fix from 3.5Nick Coghlan2016-08-211-29/+35
|\ \ | |/
| * Issue #27782: Fix m_methods handling in multiphase initNick Coghlan2016-08-211-29/+35
| | | | | | | | | | | | | | | | Multi-phase extension module import now correctly allows the ``m_methods`` field to be used to add module level functions to instances of non-module types returned from ``Py_create_mod``. Patch by Xiang Zhang.
* | Issue #12946: Remove dead code in PyModule_GetDictBerker Peksag2016-08-191-2/+1
|/ | | | | | PyModule_NewObject already sets md_dict to PyDict_New(): m->md_dict = PyDict_New();
* Issue #22570: Renamed Py_SETREF to Py_XSETREF.Serhiy Storchaka2016-04-061-1/+1
|
* Issue #20440: Massive replacing unsafe attribute setting code with specialSerhiy Storchaka2015-12-241-2/+1
| | | | macro Py_SETREF.
* Issue #24268: Address some PEP 489 refleaksNick Coghlan2015-05-231-0/+1
| | | | | | | | - missing DECREF in PyModule_FromDefAndSpec2 - missing DECREF in PyType_FromSpecAndBases2 - missing DECREF in _testmultiphase module Patch by Petr Viktorin
* PEP 489: Multi-phase extension module initializationNick Coghlan2015-05-231-52/+283
| | | | | | | | | | | | | | | | | | | | | | | Known limitations of the current implementation: - documentation changes are incomplete - there's a reference leak I haven't tracked down yet The leak is most visible by running: ./python -m test -R3:3 test_importlib However, you can also see it by running: ./python -X showrefcount Importing the array or _testmultiphase modules, and then deleting them from both sys.modules and the local namespace shows significant increases in the total number of active references each cycle. By contrast, with _testcapi (which continues to use single-phase initialisation) the global refcounts stabilise after a couple of cycles.
* Removed unintentional trailing spaces in non-external and non-generated C files.Serhiy Storchaka2015-03-181-1/+1
|
* sprinkle some _PyId goodness around moduleobject.cBenjamin Peterson2014-04-241-9/+19
|
* do not override errors from descriptors on modulesBenjamin Peterson2014-04-241-10/+9
|
* Issue8297: module attribute lookup failures now include module name in error ↵Ethan Furman2014-04-241-2/+26
| | | | message.
* Issue #19255: Clear error after failed PyDict_SetItem() on shutdown.Serhiy Storchaka2014-02-121-2/+4
|\ | | | | | | This silences a Coverity complain.
| * Issue #19255: Clear error after failed PyDict_SetItem() on shutdown.Serhiy Storchaka2014-02-121-2/+4
| | | | | | | | This silences a Coverity complain.
* | Issue #19255: The builtins module is restored to initial value beforeSerhiy Storchaka2014-02-101-5/+8
| | | | | | | | cleaning other modules. The sys and builtins modules are cleaned last.
* | Implement PEP 451 (ModuleSpec).Eric Snow2013-11-221-48/+5
| |
* | Issue #18214: Improve finalization of Python modules to avoid setting their ↵Antoine Pitrou2013-07-311-8/+21
| | | | | | | | globals to None, in most cases.
* | #17115,17116: Have modules initialize the __package__ and __loader__Brett Cannon2013-05-041-13/+26
|/ | | | | | | | | | | | | | | | | attributes to None. The long-term goal is for people to be able to rely on these attributes existing and checking for None to see if they have been set. Since import itself sets these attributes when a loader does not the only instances when the attributes are None are from someone overloading __import__() and not using a loader or someone creating a module from scratch. This patch also unifies module initialization. Before you could have different attributes with default values depending on how the module object was created. Now the only way to not get the same default set of attributes is to circumvent initialization by calling ModuleType.__new__() directly.
* Issue #15394: Fix ref leaks in PyModule_Create.Meador Inge2012-07-191-1/+7
|\ | | | | | | Patch by Julia Lawall.
| * Issue #15394: Fix ref leaks in PyModule_Create.Meador Inge2012-07-191-1/+7
| | | | | | | | Patch by Julia Lawall.
* | issue 14660: Implement PEP 420, namespace packages.Eric V. Smith2012-05-251-2/+31
| |
* | Issues #13959, 14647: Re-implement imp.reload() in Lib/imp.py.Brett Cannon2012-04-291-1/+1
| | | | | | | | Thanks to Eric Snow for the patch.
* | Rename _Py_identifier to _Py_IDENTIFIER.Martin v. Löwis2011-10-141-1/+1
| |
* | Use identifier API for PyObject_GetAttrString.Martin v. Löwis2011-10-101-1/+2
| |
* | Implement PEP 393.Martin v. Löwis2011-09-281-5/+4
| |
* | indicate return value on __dir__ methodsBenjamin Peterson2011-05-241-1/+1
| |
* | move specialized dir implementations into __dir__ methods (closes #12166)Benjamin Peterson2011-05-241-1/+29
| |
* | Issue #3080: Add PyModule_NewObject() functionVictor Stinner2011-03-041-7/+16
| |
* | Issue #3080: Add PyModule_GetNameObject()Victor Stinner2011-02-231-14/+29
|/ | | | | repr(module) uses %R to format module name and filenames, instead of '%s' and '%U', so surrogates from undecodable bytes in a filename (PEP 383) are escaped.
* #4236: avoid possible Fatal Error when import is called from __del__R. David Murray2010-12-141-2/+3
| | | | Patch by Simon Cross, crasher test code by Martin von Löwis.
* Reverted accidental commit (from r87159)Alexander Belopolsky2010-12-101-17/+3
|
* Updated UCD version and unicode.org links to Unicode 6.0.0Alexander Belopolsky2010-12-101-3/+17
|
* Merge branches/pep-0384.Martin v. Löwis2010-12-031-1/+1
|
* prefer clearing global objects to obscure module.__dict__ bugs #10068Benjamin Peterson2010-10-121-4/+1
|
* Issue #9425: Create PyModule_GetFilenameObject() functionVictor Stinner2010-08-171-7/+13
| | | | | | ... to get the filename as a unicode object, instead of a byte string. Function needed to support unencodable filenames. Deprecate PyModule_GetFilename() in favor on the new function.
* Issue #9425: Create PyErr_WarnFormat() functionVictor Stinner2010-08-131-10/+7
| | | | | | | Similar to PyErr_WarnEx() but use PyUnicode_FromFormatV() to format the warning message. Strip also some trailing spaces.
* Issue #6697: Fix a crash if a module attribute name contains a surrogateVictor Stinner2010-05-191-8/+20
|
* Recorded merge of revisions 81029 via svnmerge fromAntoine Pitrou2010-05-091-321/+321
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines Untabify C files. Will watch buildbots. ........
* module_repr(): use %U to format the file nameVictor Stinner2010-05-071-5/+15
| | | | Avoid useless encode/decode of the filename