Stefan Krah
49d0479357
Add unused third arg for the benefit of Valgrind.
13 years ago
Victor Stinner
c82729e44f
Issue #19437 : Fix fold_unaryops_on_constants() of the peephole optimizer, clear
the exception when PyList_Append() fails
13 years ago
Nick Coghlan
8b097b4ed7
Close #17828 : better handling of codec errors
- output type errors now redirect users to the type-neutral
convenience functions in the codecs module
- stateless errors that occur during encoding and decoding
will now be automatically wrapped in exceptions that give
the name of the codec involved
13 years ago
Victor Stinner
22af2599a9
Issue #19437 : Fix PyImport_ImportModuleLevelObject(), handle
PyUnicode_Substring() failure (ex: MemoryError)
13 years ago
Victor Stinner
3f36a5736b
Issue #19515 : Remove identifiers duplicated in the same file.
Patch written by Andrei Dorian Duma.
13 years ago
Victor Stinner
dcf17f8a55
Issue #19466 : Fix typo. Patch written by Vajrasky Kok.
13 years ago
Victor Stinner
45956b9a33
Close #19466 : Clear the frames of daemon threads earlier during the Python
shutdown to call objects destructors. So "unclosed file" resource warnings are
now corretly emitted for daemon threads.
13 years ago
Victor Stinner
bd303c165b
Issue #19512 , #19515 : remove shared identifiers, move identifiers where they
are used.
Move also _Py_IDENTIFIER() defintions to the top in modified files to remove
identifiers duplicated in the same file.
13 years ago
Victor Stinner
efa7a0e155
print_error_text() doesn't encode the filename anymore
Use aslo PyUnicode_FromFormat() to format the line so only one call to
PyFile_WriteObject() is needed. tb_displayline() of Python/traceback.c has
similar implementation.
13 years ago
Victor Stinner
79ed4c744a
remove an outdated comment
The comment is meaningless since changeset 4e985a96a612.
13 years ago
Victor Stinner
53e9ec48e5
Issue #19512 : Use the new _PyId_builtins identifier
13 years ago
Victor Stinner
ad14ccd047
Issue #19512 : add _PyUnicode_CompareWithId() function
_PyUnicode_CompareWithId() is faster than PyUnicode_CompareWithASCIIString()
when both strings are equal and interned.
Add also _PyId_builtins identifier for "builtins" common string.
13 years ago
Victor Stinner
937114f704
print_exception(): don't encode the module name to UTF-8
Replace _PyUnicode_AsString()+strcmp() with PyUnicode_CompareWithASCIIString().
13 years ago
Victor Stinner
eaa2883d15
Issue #19512 : builtin print() function uses an identifier instead of literal
string "flush" to call the flush method
13 years ago
Victor Stinner
ae9f161b43
Issue #19512 : __build_class() builtin now uses an identifier for the "metaclass" string
13 years ago
Victor Stinner
090543736f
Issue #19512 : add some common identifiers to only create common strings once,
instead of creating temporary Unicode string objects
Add also more identifiers in pythonrun.c to avoid temporary Unicode string
objets for the interactive interpreter.
13 years ago
Victor Stinner
cab75e3e1e
Issue #19512 : PRINT_EXPR bytecode now uses an identifier to get sys.displayhook
to only create the "displayhook" string once
13 years ago
Victor Stinner
d67bd45537
Issue #19512 : Add _PySys_GetObjectId() and _PySys_SetObjectId() functions
13 years ago
Victor Stinner
b44562b6b9
Issue #19512 : eval() and exec() now use an identifier for "__builtins__" string
13 years ago
Victor Stinner
95701bdf40
Issue #19512 : Add PyRun_InteractiveOneObject() function
Only decode the filename once. PyRun_InteractiveOneObject() uses an identifier
for "<string>" string, so the byte string is only decoded once.
13 years ago
Victor Stinner
4ee41c5839
Issue #19512 : _print_total_refs() now uses an identifier to get "showrefcount"
key from sys._xoptions
13 years ago
Victor Stinner
d02fbb8f71
Issue #19512 : sys_displayhook() now uses an identifier for "builtins"
dictionary key and only decodes "\n" string once to write a newline.
So "builtins" and "\n" are only decoded once from UTF-8, at the first call.
13 years ago
Victor Stinner
98e818b8e3
Issue #19437 : Fix compiler_class(), handle compiler_lookup_arg() failure
13 years ago
Brett Cannon
2b8fc303ad
Abstract out stat calls in importlib for easier experimentation.
13 years ago
Brett Cannon
f6901c8baa
Issue #19410 : Put back in special-casing of '' for
importlib.machinery.FileFinder.
While originally moved to stop special-casing '' as PathFinder farther
up the typical call chain now uses the cwd in the instance of '', it
was deemed an unnecessary risk to breaking subclasses of FileFinder to
take the special-casing out.
13 years ago
Eric Snow
cdf601281f
Issue #19413 : Restore pre-3.3 reload() semantics of re-finding modules.
13 years ago
Victor Stinner
dcdd05b0b4
Close #19442 : warn_explicit() does nothing when called late during Python shutdown
After more tests, I now think that it is the safest option.
13 years ago
Victor Stinner
359fabc19f
Issue #19437 : Cleanup r_ref() of the marshal module
13 years ago
Victor Stinner
d5cae6f143
Issue #19437 : Fix r_object() of marshal module, handle PyDict_SetItem() failure
for TYPE_DICT and stop immedialty on first r_object() failure
13 years ago
Victor Stinner
b1b7b1834b
Issue #19437 : Fix r_object() of marshal module, handle r_byte() failure for
TYPE_SMALL_TUPLE
13 years ago
Victor Stinner
763b0d19c9
Issue #19437 : Fix r_PyLong() of marshal module, stop immediatly at first
failure, don't read any more data
13 years ago
Victor Stinner
ae233eab5c
Issue #19437 : Fix show_warning() of _warnings, stop at the first error to not
call a Python function with an exception set
13 years ago
Victor Stinner
3cd04aa1b2
Issue #19437 : Fix get_filter() from _warnings, don't call PyObject_IsSubclass()
with an exception set
13 years ago
Benjamin Peterson
7f69dcac16
make string literal const
13 years ago
Benjamin Peterson
8f169489c4
update comment
13 years ago
Victor Stinner
856f45f09c
Issue #19442 : Fix warnings emitted during Python shutdown
Warnings may be emitted during Python shutdown, like "unclosed file XXX".
During shutdown, globals()['__main__'] may be None.
13 years ago
Victor Stinner
a4c704b260
Issue #19424 : Fix the warnings module to accept filename containing surrogate
characters.
13 years ago
Victor Stinner
41bb43a71e
Issue #18408 : Add a new PyFrame_FastToLocalsWithError() function to handle
exceptions when merging fast locals into f_locals of a frame.
PyEval_GetLocals() now raises an exception and return NULL on failure.
13 years ago
Victor Stinner
ce5f4fba11
Issue #19421 : fix a check in warnings.warn() to be able to use it during Python
finalization.
sys.argv is set to None during Python finalization: add PyList_Check() to avoid
a crash in PyList_Size().
13 years ago
Victor Stinner
8fea252a50
Issue #18520 : fix reference leak in _PySys_Init()
13 years ago
Christian Heimes
49e61806f5
Issue #18603 : Ensure that PyOS_mystricmp and PyOS_mystrnicmp are in the
Python executable and not removed by the linker's optimizer.
13 years ago
Guido van Rossum
7be5d7d0e0
Issue 19306: Add extra hints to faulthandler stack dumps that they are upside down.
13 years ago
Benjamin Peterson
6b4f7803f8
cleanup the construction of __qualname__ ( closes #19301 again)
13 years ago
Nick Coghlan
6de9200e57
Close #19313 : remove no longer needed Py_XINCREF
Eliminates a refleak introduced in commit b4a325275fb0
13 years ago
Benjamin Peterson
34d33a595b
removal u_qualname, since compiler_scope_qualname is only ever called once
13 years ago
Benjamin Peterson
a8a38b8e4f
strengthen condition and add assertion
13 years ago
Benjamin Peterson
3d9e481ece
give explicitly global functions and classes a global __qualname__ ( closes #19301 )
13 years ago
Serhiy Storchaka
c679227e31
Issue #1772673 : The type of `char*` arguments now changed to `const char*`.
13 years ago
Brett Cannon
58f5680462
Issue #18810 : Be optimistic with stat calls when seeing if a directory
exists when checking for a package.
Before there was an isdir check and then various isfile checks for
possible __init__ files when looking for a package.
This change drops the isdir check by leaning
on the assumption that a directory will not contain something named
after the module being imported which is not a directory. If the module
is a package then it saves a stat call. If there is nothing in the
directory with the potential package name it also saves a stat call.
Only if there is something in the directory named the same thing as
the potential package will the number of stat calls increase
(due to more wasteful __init__ checks).
Semantically there is no change as the isdir check moved
down so that namespace packages continue to have no chance of
accidentally collecting non-existent directories.
13 years ago
Brett Cannon
bb9e481efa
Issue #18416 : Fix various os calls in importlib.machinery.FileFinder
now that self.path is no longer forced to '.'.
13 years ago