[issue40840] lzma.h file not found building on macOS

2020-06-01 Thread Ned Deily


Ned Deily  added the comment:

For Homebrew users, the Devguide currently recommends:

$ brew install openssl xz gdbm

./configure --with-pydebug --with-openssl=$(brew --prefix openssl)

I don't use Homebrew myself so I may be missing something
obvious but, after a bit of experimentation,
I think the following might be the simplest version of the
above that works with Homebrew installed in a non-default location:

$ CPPFLAGS="-I$(brew --prefix)/include" \
  LDFLAGS="-L$(brew --prefix)/lib" \
  ./configure --with-pydebug \
  --with-openssl=$(brew --prefix openssl)

Could you try it on your systems, please?

BTW, I notice that you are also installing zlib. There was a
longstanding bug in the 2.7 setup.py that caused the system
zlib to not be found in some cases. That was fixed some time
back. So there is no normally no need to install a third-party
zlib; current Python builds will automatically use the
Apple-supplied system zlib.

Since, like openssl, Homebrew installs zlib "keg-only",
you would need to explicitly reference its locations:

$ CPPFLAGS="-I$(brew --prefix)/include -I$(brew --prefix zlib)/include" \
  LDFLAGS="-L$(brew --prefix)/lib -L$(brew --prefix zlib)/lib" \
  ./configure --with-pydebug \
  --with-openssl=$(brew --prefix openssl)

But, at the moment, both the 10.15 system zlib and the Homebrew
zlib are the same version, 1.2.11, so it doesn't seem necessary.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39947] [C API] Make the PyThreadState structure opaque (move it to the internal C API)

2020-06-01 Thread STINNER Victor


STINNER Victor  added the comment:

Cython still access multiple PyThreadState members which have no getter or 
setter yet.

__Pyx_PyErr_ExceptionMatchesInState():

PyObject *exc_type = tstate->curexc_type;
...

=> internal _PyErr_Occurred(tstate) could solve this issue: move it the 
public/private API? Or expose internal _PyErr_ExceptionMatches(tstate, exc)?

__Pyx_ErrRestoreInState() is a reimplementation of internal _PyErr_Restore(): 
get/set curexc_type, curexc_value and curexc_traceback members.

__Pyx_PyFunction_FastCallNoKw:

static PyObject* __Pyx_PyFunction_FastCallNoKw(...) {
...
++tstate->recursion_depth;
Py_DECREF(f);
--tstate->recursion_depth;
return result;
}

Why not calling Py_EnterRecursiveCall/Py_LeaveRecursiveCall?

There are likely others.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40241] [C API] Make PyGC_Head structure opaque, or even move it to the internal C API

2020-06-01 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +19820
pull_request: https://github.com/python/cpython/pull/20586

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39583] Remove superfluous "extern C" bits from Include/cpython/*.h

2020-06-01 Thread STINNER Victor


Change by STINNER Victor :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.10 -Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23557] Misc/SpecialBuilds.txt contains outdated information about PYMALLOC_DEBUG

2020-06-01 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26543] [EASY] imaplib noop Debug: bytes vs Unicode bug in debug mode

2020-06-01 Thread STINNER Victor


STINNER Victor  added the comment:

Merged, thanks for the fix.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26543] [EASY] imaplib noop Debug: bytes vs Unicode bug in debug mode

2020-06-01 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 8a3d2af997e3702eac4c5b012537be39ada36888 by Sanyam Khurana in 
branch 'master':
bpo-26543: Fix IMAP4.noop when debug mode is enabled (GH-15206)
https://github.com/python/cpython/commit/8a3d2af997e3702eac4c5b012537be39ada36888


--
nosy: +vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35228] Index search in CHM help crashes viewer

2020-06-01 Thread Inada Naoki


Inada Naoki  added the comment:

I think it's time to abandon chm file.  It is too old.  MS doesn't maintain it 
anymore.
Let's promote ePub and PDF instead.

--
nosy: +inada.naoki

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40840] lzma.h file not found building on macOS

2020-06-01 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

In [this 
commit](https://github.com/jaraco/jaraco.develop/commit/e3e5f66ca6693d8ec3abd31d99d491f6dfa1f67d),
 I include "xz" in the routine. Should Python's developer docs include 
something like that to ensure compatibility?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40799] Create Lib/_pydatetime.py file to optimize "import datetime" when _datetime is available

2020-06-01 Thread STINNER Victor


STINNER Victor  added the comment:

About _strptime, I see that the time.strptime() imports internally the 
_strptime module. If we move _strptime inside datetime: does it mean that 
calling time.strptime() would have to import the datetime module? It doesn't 
sound right to me. I see the time as the low-level interface: it should not 
rely on the high-level interface. I prefer to separate _strptime module from 
the datetime module.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40840] lzma.h file not found building on macOS

2020-06-01 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

This issue doesn't happen on my mac that installs homebrew globally. Do the 
build instructions assume Homebrew is installed system-wide?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40840] lzma.h file not found building on macOS

2020-06-01 Thread Jason R. Coombs


New submission from Jason R. Coombs :

Attempting to build Python on macOS following [the 
instructions](https://devguide.python.org/setup/#macos-and-os-x) (for Homebrew).

xz is installed:

```
$ brew --prefix xz  
  
/Users/jaraco/.local/homebrew/opt/xz
```

Yet, after running `./configure`, which makes no mention of "xz" or "lzma", 
"make" fails with:

```
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv 
-O3 -Wall -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter 
-Wno-missing-field-initializers -Wstrict-prototypes 
-Werror=implicit-function-declaration -fvisibility=hidden -I./Include/internal 
-I./Include -I. -I/Users/jaraco/code/public/cpython/Include 
-I/Users/jaraco/code/public/cpython -c 
/Users/jaraco/code/public/cpython/Modules/_lzmamodule.c -o 
build/temp.macosx-10.15-x86_64-3.9/Users/jaraco/code/public/cpython/Modules/_lzmamodule.o
/Users/jaraco/code/public/cpython/Modules/_lzmamodule.c:16:10: fatal error: 
'lzma.h' file not found
#include 
 ^~~~
1 error generated.
```

Yet the file is there: 

```
$ ls ~/.local/homebrew/opt/xz/include   
  
lzma   lzma.h
```

What's missing from the instructions that I should be doing?

--
messages: 370582
nosy: jaraco
priority: normal
severity: normal
status: open
title: lzma.h file not found building on macOS

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40840] lzma.h file not found building on macOS

2020-06-01 Thread Jason R. Coombs


Change by Jason R. Coombs :


--
components: +macOS
nosy: +ned.deily, ronaldoussoren

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35228] Index search in CHM help crashes viewer

2020-06-01 Thread Steve Dower


Steve Dower  added the comment:

Can anyone confirm that you've got an active code page of something other than 
1252 ("standard" US English)? I'm not able to reproduce this easily, and I 
wonder if it's because of that setting.

Easiest way to check is in Python:
>>> import locale
>>> locale.getpreferredencoding()
'cp1252'

--
versions: +Python 3.10, Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14527] How to link with a non-system libffi?

2020-06-01 Thread Warren Hardy

Warren Hardy  added the comment:

I tried Rupert Nash’s changes to Makefile.pre.in, configure, configure.ac and 
setup.py. 

I can confirm this changes worked for me. 

I had to edit the Makefile and enter the LIBFFI_INCLUDEDIR and LIBFFI_LIBDIR
this might be due to me being a newb about this stuff, and having some 
configuration setting wrong.

--
nosy: +munocat

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40403] pdb does not drop into debugger upon SyntaxError caused by ast.literal_eval

2020-06-01 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

This is related to issue 16180, it may be possible to improve the situation by 
trying to determine whether the SyntaxError is in the file or came during its 
execution by looking at the filename but it's probably very brittle:



 # In most cases SystemExit does not warrant a post-mortem session.
 print("The program exited via sys.exit(). Exit status:", end=' ')
 print(sys.exc_info()[1])
-except SyntaxError:
-traceback.print_exc()
-sys.exit(1)
-except:
+except Exception as e:
+if (type(e) is SyntaxError and
+e.filename == os.path.abspath(mainpyfile)):
+traceback.print_exc()
+sys.exit(1)
 traceback.print_exc()
 print("Uncaught exception. Entering post mortem debugging")
 print("Running 'cont' or 'step' will restart the program")

--
nosy: +terry.reedy, xdegaye

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40788] Build issue Solaris 10 Sparc

2020-06-01 Thread Warren Hardy


Warren Hardy  added the comment:

I found another bug Issue14527

https://bugs.python.org/issue14527

In bug 14527 was a reference to some changes, these worked to fix ctypes

https://github.com/python/cpython/pull/20451/files

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25782] CPython hangs on error __context__ set to the error itself

2020-06-01 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40741] Upgrade to SQLite v3.32.1 in Windows and macOS builds

2020-06-01 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39343] Travis CI: documentation job fails in library/nntplib.rst with random network issue on news.gmane.io

2020-06-01 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19915] int.bit_at(n) - Accessing a single bit in O(1)

2020-06-01 Thread STINNER Victor


STINNER Victor  added the comment:

> Any update on this?

Since nobody proposed a PEP, no, there is no progress on this issue.

I suggest to close it because of the lack of interest to move on on this issue.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40826] PyOS_InterruptOccurred() now requires to hold the GIL: PyOS_Readline() crash

2020-06-01 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset c353764fd564e401cf47a5d9efab18c72c60014e by Victor Stinner in 
branch 'master':
bpo-40826: Fix GIL usage in PyOS_Readline() (GH-20579)
https://github.com/python/cpython/commit/c353764fd564e401cf47a5d9efab18c72c60014e


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40826] PyOS_InterruptOccurred() now requires to hold the GIL: PyOS_Readline() crash

2020-06-01 Thread STINNER Victor


STINNER Victor  added the comment:

See also bpo-40839: Disallow calling PyDict_GetItem() with the GIL released.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40839] Disallow calling PyDict_GetItem() with the GIL released

2020-06-01 Thread STINNER Victor


STINNER Victor  added the comment:

Current comment in Objects/dictobject.c:

/* We can arrive here with a NULL tstate during initialization: try
   running "python -Wi" for an example related to string interning.
   Let's just hope that no exception occurs then...  This must be
   _PyThreadState_GET() and not PyThreadState_Get() because the latter
   abort Python if tstate is NULL. */

PyDict_GetItem() is no longer called before Py_Initialize(). I reworked the 
Python startup to no longer use Python objects before Py_Initialize(): see PEP 
587 (PyConfig).


> To help C extension modules authors, I propose to keep a check at the runtime 
> even in release build. Later, we may drop this check in release mode and only 
> keep it in debug mode.

Hum, since the whole test pass with the change and it was not documented that 
it was possible to call the function with the GIL released, I changed my mind 
and only kept the runtime check in debug mode.

--
nosy: +eric.snow, ncoghlan

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40839] Disallow calling PyDict_GetItem() with the GIL released

2020-06-01 Thread STINNER Victor


STINNER Victor  added the comment:

Note: I created this issue while working on bpo-40826 "PyOS_InterruptOccurred() 
now requires to hold the GIL: PyOS_Readline() crash".

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40839] Disallow calling PyDict_GetItem() with the GIL released

2020-06-01 Thread STINNER Victor


Change by STINNER Victor :


--
keywords: +patch
pull_requests: +19819
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/20580

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40839] Disallow calling PyDict_GetItem() with the GIL released

2020-06-01 Thread STINNER Victor


New submission from STINNER Victor :

For historical reasons, it was allowed to call the PyDict_GetItem() function 
with the GIL released.
 
I propose to change PyDict_GetItem() to fail with a fatal error if it's called 
with the GIL released.

To help C extension modules authors, I propose to keep a check at the runtime 
even in release build. Later, we may drop this check in release mode and only 
keep it in debug mode.

In Python 3.8 and then 3.9, some functions started to crash when called without 
holding the GIL. It caused some bad surprises to C extension modules authors. 
Example: gdb developers with bpo-40826. In my opinion, holding the GIL was 
always required even if it is not very explicit in the documentation of the C 
API (only the documentation of few functions are explicit about the GIL).

--
components: C API
messages: 370572
nosy: vstinner
priority: normal
severity: normal
status: open
title: Disallow calling PyDict_GetItem() with the GIL released
versions: Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39583] Remove superfluous "extern C" bits from Include/cpython/*.h

2020-06-01 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset b4d5a5cca29426a282e8f1e64b2271fdd1f0a23e by Skip Montanaro in 
branch 'master':
bpo-39583: Remove superfluous "extern C" bits from Include/cpython/*.h 
(GH-18413)
https://github.com/python/cpython/commit/b4d5a5cca29426a282e8f1e64b2271fdd1f0a23e


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40403] pdb does not drop into debugger upon SyntaxError caused by ast.literal_eval

2020-06-01 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

I've looked into this, in Bdb both the part where the code is compiled and the 
one where the code is run are in the run() method 
(https://github.com/python/cpython/blob/master/Lib/bdb.py#L565-L585):


def run(self, cmd, globals=None, locals=None):
"""Debug a statement executed via the exec() function.
globals defaults to __main__.dict; locals defaults to globals.
"""
if globals is None:
import __main__
globals = __main__.__dict__
if locals is None:
locals = globals
self.reset()
if isinstance(cmd, str):
cmd = compile(cmd, "", "exec")
sys.settrace(self.trace_dispatch)
try:
exec(cmd, globals, locals)
except BdbQuit:
pass
finally:
self.quitting = True
sys.settrace(None)


This is an issue as SyntaxError may come from two lines

 - the call to compile() which means the code being run is not valid Python, in 
this case the current behaviour of PDB to exit is correct as there is nothing 
to debug
 - the call to exec() in which case a SyntaxError can happen like in the 
report, and PDB should go in post mortem debug mode.


One way to fix the issue would be to catch the error in compile() and wrap it 
in a BdbSyntaxError so that PDB can differentiate between the two, another to 
keep BDB as it is and change PDB so that it compiles the code first, and call 
run() in a second step. I think the last one is better and will start writing a 
PR for this.

--
nosy: +remi.lapeyre
versions: +Python 3.10, Python 3.7, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40826] PyOS_InterruptOccurred() now requires to hold the GIL: PyOS_Readline() crash

2020-06-01 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset cbe129692293251e7fbcea9ff0d822824d90c140 by Victor Stinner in 
branch 'master':
bpo-40826: PyOS_InterruptOccurred() requires GIL (GH-20578)
https://github.com/python/cpython/commit/cbe129692293251e7fbcea9ff0d822824d90c140


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40826] PyOS_InterruptOccurred() now requires to hold the GIL: PyOS_Readline() crash

2020-06-01 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +19818
pull_request: https://github.com/python/cpython/pull/20579

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40826] PyOS_InterruptOccurred() now requires to hold the GIL: PyOS_Readline() crash

2020-06-01 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +19817
pull_request: https://github.com/python/cpython/pull/20578

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40630] tracemalloc: allow resetting peak memory metric without touching other traces

2020-06-01 Thread STINNER Victor


STINNER Victor  added the comment:

Feature added to Python 3.9. Lukasz allowed to add the feature to Python 3.9 
beta2:
https://github.com/python/cpython/pull/20102#issuecomment-632728791

--
versions: +Python 3.9 -Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40630] tracemalloc: allow resetting peak memory metric without touching other traces

2020-06-01 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 3c7609a23cf6e011f2cd411e28d9dcb1b087929c by Huon Wilson in branch 
'3.9':
[3.9] bpo-40630: Add tracemalloc.reset_peak (GH-20102) (GH-20545)
https://github.com/python/cpython/commit/3c7609a23cf6e011f2cd411e28d9dcb1b087929c


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40630] tracemalloc: allow resetting peak memory metric without touching other traces

2020-06-01 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 39de8e4b6f139f8d8284732bd7bb6e5ccced29fa by Huon Wilson in branch 
'master':
bpo-40630: adjust tracemalloc.reset_peak docs for backport to 3.9 (GH-20546)
https://github.com/python/cpython/commit/39de8e4b6f139f8d8284732bd7bb6e5ccced29fa


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39943] Meta: Clean up various issues in C internals

2020-06-01 Thread STINNER Victor


STINNER Victor  added the comment:

If someone is interested, there is a one remaining compiler warning in 
frameobject.c which is likely easy to fix:

D:\a\cpython\cpython\Objects\frameobject.c(400,1): warning C4267: 
'initializing': conversion from 'size_t' to 'int', possible loss of data 
[D:\a\cpython\cpython\PCbuild\pythoncore.vcxproj]

See https://bugs.python.org/issue40228#msg368383

---

Moreover, the following change introduced a warning in pythonrun.c:

D:\a\cpython\cpython\Python\pythonrun.c(579,21): warning C4244: '=': conversion 
from 'Py_ssize_t' to 'int', possible loss of data 
[D:\a\cpython\cpython\PCbuild\pythoncore.vcxproj]

commit 15bc9ab301d73f20bff47a12ef05326feb40f797
Author: Guido van Rossum 
Date:   Thu May 14 19:22:48 2020 -0700

bpo-40612: Fix SyntaxError edge cases in traceback formatting (GH-20072)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39943] Meta: Clean up various issues in C internals

2020-06-01 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 06e3a27a3c863495390a07c695171a8e62a6e0d2 by Ammar Askar in branch 
'master':
bpo-39943: Fix MSVC warnings in sre extension (GH-20508)
https://github.com/python/cpython/commit/06e3a27a3c863495390a07c695171a8e62a6e0d2


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39593] ctypes s_set() uses strlen() and so truncates string at null character

2020-06-01 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks Hai Shi.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.10 -Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39593] ctypes s_set() uses strlen() and so truncates string at null character

2020-06-01 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset a97011b9b8c8111f42e1e7594081956136d848da by Hai Shi in branch 
'master':
bpo-39593: Add test on ctypes cfield.c s_set() (GH-18424)
https://github.com/python/cpython/commit/a97011b9b8c8111f42e1e7594081956136d848da


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39791] New `files()` api from importlib_resources.

2020-06-01 Thread Jason R. Coombs


Change by Jason R. Coombs :


--
pull_requests: +19816
pull_request: https://github.com/python/cpython/pull/20576

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1635741] Py_Finalize() doesn't clear all Python objects at exit

2020-06-01 Thread Dong-hee Na


Dong-hee Na  added the comment:


New changeset e9684fac5a158be9806304a676e619857520a4dc by Dong-hee Na in branch 
'master':
bpo-1635741: Port fcntl module to multiphase initialization (GH-20540)
https://github.com/python/cpython/commit/e9684fac5a158be9806304a676e619857520a4dc


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40831] Wrong statement that bytes paths are deprecated under Windows regarding MAX_PATH docs

2020-06-01 Thread Steve Dower


Change by Steve Dower :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40831] Wrong statement that bytes paths are deprecated under Windows regarding MAX_PATH docs

2020-06-01 Thread miss-islington


miss-islington  added the comment:


New changeset d0dc369a90e356bf2eba651816feb7ad736ce28a by Miss Islington (bot) 
in branch '3.8':
bpo-40831: Remove an incorrect statement in the Windows docs (GH-20570)
https://github.com/python/cpython/commit/d0dc369a90e356bf2eba651816feb7ad736ce28a


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40831] Wrong statement that bytes paths are deprecated under Windows regarding MAX_PATH docs

2020-06-01 Thread miss-islington


miss-islington  added the comment:


New changeset d7f2fd2ae54161362c7f3d28bd7a1840a796e63d by Miss Islington (bot) 
in branch '3.7':
bpo-40831: Remove an incorrect statement in the Windows docs (GH-20570)
https://github.com/python/cpython/commit/d7f2fd2ae54161362c7f3d28bd7a1840a796e63d


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40831] Wrong statement that bytes paths are deprecated under Windows regarding MAX_PATH docs

2020-06-01 Thread miss-islington


miss-islington  added the comment:


New changeset a169961dfc777eb467a2b1027391285a7706329a by Miss Islington (bot) 
in branch '3.9':
bpo-40831: Remove an incorrect statement in the Windows docs (GH-20570)
https://github.com/python/cpython/commit/a169961dfc777eb467a2b1027391285a7706329a


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40831] Wrong statement that bytes paths are deprecated under Windows regarding MAX_PATH docs

2020-06-01 Thread miss-islington


Change by miss-islington :


--
pull_requests: +19815
pull_request: https://github.com/python/cpython/pull/20575

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40831] Wrong statement that bytes paths are deprecated under Windows regarding MAX_PATH docs

2020-06-01 Thread Steve Dower


Steve Dower  added the comment:


New changeset c897bbdb284c3780ef6cec8a3870935a6bb7 by Zackery Spytz in 
branch 'master':
bpo-40831: Remove an incorrect statement in the Windows docs (GH-20570)
https://github.com/python/cpython/commit/c897bbdb284c3780ef6cec8a3870935a6bb7


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40831] Wrong statement that bytes paths are deprecated under Windows regarding MAX_PATH docs

2020-06-01 Thread miss-islington


Change by miss-islington :


--
pull_requests: +19814
pull_request: https://github.com/python/cpython/pull/20574

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40831] Wrong statement that bytes paths are deprecated under Windows regarding MAX_PATH docs

2020-06-01 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 6.0 -> 7.0
pull_requests: +19813
pull_request: https://github.com/python/cpython/pull/20573

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40826] PyOS_InterruptOccurred() now requires to hold the GIL: PyOS_Readline() crash

2020-06-01 Thread STINNER Victor


STINNER Victor  added the comment:

I add "Python 3.8" version: it's also affected.

--
versions: +Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40826] PyOS_InterruptOccurred() now requires to hold the GIL: PyOS_Readline() crash

2020-06-01 Thread STINNER Victor


STINNER Victor  added the comment:

So PyOS_InterruptOccurred() must be called with the GIL held since 3.8, it's 
just that the nobody noticed the bug before.

If SIGGINT is tripped and the GIL is released, PyOS_InterruptOccurred() does 
also crash in Python 3.8.

--

One way to see the bug in Python 3.8 without having to trip SIGINT.

Apply this patch:

diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c
index 0c9a2671fe..b850af3163 100644
--- a/Modules/signalmodule.c
+++ b/Modules/signalmodule.c
@@ -1729,11 +1729,12 @@ PyOS_FiniInterrupts(void)
 int
 PyOS_InterruptOccurred(void)
 {
+_PyRuntimeState *runtime = &_PyRuntime;
+if (!is_main(runtime)) {
+return 0;
+}
+
 if (_Py_atomic_load_relaxed([SIGINT].tripped)) {
-_PyRuntimeState *runtime = &_PyRuntime;
-if (!is_main(runtime)) {
-return 0;
-}
 _Py_atomic_store_relaxed([SIGINT].tripped, 0);
 return 1;
 }

$ make
$ find -name "*readline*so" -delete
$ ./python
Python 3.8.3+ (heads/3.8-dirty:00a240bf7f, Jun  1 2020, 17:24:09) 
[GCC 10.1.1 20200507 (Red Hat 10.1.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os; os.close(0)
>>>
Erreur de segmentation (core dumped)

---

Reproduce the bug in Python 3.8 without modifying the code, using gdb to 
trigger events SIGINT at the right place:

$ gdb ./python
(gdb) b my_fgets
Breakpoint 1 at 0x68b941: file Parser/myreadline.c, line 39.

(gdb) run
Python 3.8.3+ (heads/3.8:00a240bf7f, Jun  1 2020, 17:27:24) 
[GCC 10.1.1 20200507 (Red Hat 10.1.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

Breakpoint 1, my_fgets (...)
(gdb) p (void)close(0)

(gdb) delete 1

(gdb) signal SIGINT
Continuing with signal SIGINT.

Program received signal SIGSEGV, Segmentation fault.
is_main (runtime=0x7ff6c0 <_PyRuntime>) at ./Modules/signalmodule.c:193
193 PyInterpreterState *interp = 
_PyRuntimeState_GetThreadState(runtime)->interp;

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24921] Operator precedence table in 5.15 should be highest to lowest precedence

2020-06-01 Thread Ama Aje My Fren


Change by Ama Aje My Fren :


--
keywords: +patch
nosy: +amaajemyfren
nosy_count: 5.0 -> 6.0
pull_requests: +19812
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/20572

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40826] PyOS_InterruptOccurred() now requires to hold the GIL: PyOS_Readline() crash

2020-06-01 Thread STINNER Victor


STINNER Victor  added the comment:

It seems like this issue was introduced by this change:

commit 728189884e0e128c4ffc57b785b04584d57a90c0
Author: Victor Stinner 
Date:   Thu Mar 26 22:28:11 2020 +0100

bpo-38644: Pass tstate explicitly in signalmodule.c (GH-19184)

PyOS_InterruptOccurred() now checks _Py_ThreadCanHandleSignals()
before checking if SIGINT is tripped.

 Include/internal/pycore_pyerrors.h |   2 +
 Modules/signalmodule.c | 152 ++---
 Python/ceval.c |   4 +-
 3 files changed, 93 insertions(+), 65 deletions(-)

Before:
---
static inline int
_Py_IsMainInterpreter(PyThreadState* tstate)
{   
/* Use directly _PyRuntime rather than tstate->interp->runtime, since
   this function is used in performance critical code path (ceval) */
return (tstate->interp == _PyRuntime.interpreters.main);
}   

static inline int  
_Py_ThreadCanHandleSignals(PyThreadState *tstate)
{
return (_Py_IsMainThread() && _Py_IsMainInterpreter(tstate));
}   

static int 
thread_can_handle_signals(void)
{
PyThreadState *tstate = _PyThreadState_GET();  
return _Py_ThreadCanHandleSignals(tstate);
}

int
PyOS_InterruptOccurred(void)
{
if (_Py_atomic_load_relaxed([SIGINT].tripped)) {
if (!thread_can_handle_signals()) {
return 0;
}
_Py_atomic_store_relaxed([SIGINT].tripped, 0);
return 1;
}
return 0;
}
---

After:
---
static inline int 
_Py_IsMainInterpreter(PyThreadState* tstate)
{   
/* Use directly _PyRuntime rather than tstate->interp->runtime, since 
   this function is used in performance critical code path (ceval) */ 
return (tstate->interp == _PyRuntime.interpreters.main);
}

static inline int   
_Py_ThreadCanHandleSignals(PyThreadState *tstate)  
{  
return (_Py_IsMainThread() && _Py_IsMainInterpreter(tstate));
}

int
PyOS_InterruptOccurred(void)
{
PyThreadState *tstate = _PyThreadState_GET();
if (!_Py_ThreadCanHandleSignals(tstate)) {
return 0;
}

if (!_Py_atomic_load_relaxed([SIGINT].tripped)) {
return 0;
}

_Py_atomic_store_relaxed([SIGINT].tripped, 0);
return 1;
}
---

The difference is that tstate->interp is now checked *before* checking if 
SIGINT signal is tripped.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40826] PyOS_InterruptOccurred() now requires to hold the GIL: PyOS_Readline() crash

2020-06-01 Thread STINNER Victor


STINNER Victor  added the comment:

I can reproduce PyOS_InterruptOccurred() crash in Python 3.8 if I remove 
readline.cpython-38d-x86_64-linux-gnu.so and I disable EINTR error checking in 
my_fgets():

diff --git a/Parser/myreadline.c b/Parser/myreadline.c
index 43e5583b8b..2712dedacd 100644
--- a/Parser/myreadline.c
+++ b/Parser/myreadline.c
@@ -73,7 +73,7 @@ my_fgets(char *buf, int len, FILE *fp)
 clearerr(fp);
 return -1; /* EOF */
 }
-#ifdef EINTR
+#if 0
 if (err == EINTR) {
 int s;
 PyEval_RestoreThread(_PyOS_ReadlineTState);


vstinner@apu$ ./python
Python 3.8.3+ (heads/3.8-dirty:00a240bf7f, Jun  1 2020, 17:00:22) 
[GCC 10.1.1 20200507 (Red Hat 10.1.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
^C
Erreur de segmentation (core dumped)


I cannot reproduce the issue in Python 3.7.

---

Python 3.7:
---
int
PyOS_InterruptOccurred(void)
{
if (_Py_atomic_load_relaxed([SIGINT].tripped)) {
if (PyThread_get_thread_ident() != main_thread)
return 0;
_Py_atomic_store_relaxed([SIGINT].tripped, 0);
return 1;
}
return 0;
}
---

Python 3.8:
---
static int
is_main(_PyRuntimeState *runtime)
{
unsigned long thread = PyThread_get_thread_ident();
PyInterpreterState *interp = 
_PyRuntimeState_GetThreadState(runtime)->interp;
return (thread == runtime->main_thread
&& interp == runtime->interpreters.main);
}

int
PyOS_InterruptOccurred(void)
{
if (_Py_atomic_load_relaxed([SIGINT].tripped)) {
_PyRuntimeState *runtime = &_PyRuntime;
if (!is_main(runtime)) {
return 0;
}
_Py_atomic_store_relaxed([SIGINT].tripped, 0);
return 1;
}
return 0;
}
---

is_main() function was added in Python 3.8 by:

commit 64d6cc826dacebc2493b1bb5e8cb97828eb76f81
Author: Eric Snow 
Date:   Sat Feb 23 15:40:43 2019 -0700

bpo-35724: Explicitly require the main interpreter for signal-handling. 
(GH-11530)

Ensure that the main interpreter is active (in the main thread) for 
signal-handling operations. This is increasingly relevant as people use 
subinterpreters more.

https://bugs.python.org/issue35724

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40826] PyOS_InterruptOccurred() now requires to hold the GIL: PyOS_Readline() crash

2020-06-01 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 3026cad59b87751a9215111776cac8e819458fce by Victor Stinner in 
branch 'master':
bpo-40826: Add _Py_EnsureTstateNotNULL() macro (GH-20571)
https://github.com/python/cpython/commit/3026cad59b87751a9215111776cac8e819458fce


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40686] Compiler warnings in _zoneinfo.c on Windows build in 64-bit

2020-06-01 Thread Dong-hee Na


Dong-hee Na  added the comment:

Two things.

1. GH-20342 solved this issue?
2. If not what's left for this issue? :)

Sorry, Normally I should check the current status.
But I don't have Windows machine so I can not test it.
However the update will help contributors who want to deal with :)

Thanks Pablo

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40826] PyOS_InterruptOccurred() now requires to hold the GIL: PyOS_Readline() crash

2020-06-01 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +19811
pull_request: https://github.com/python/cpython/pull/20571

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40826] PyOS_InterruptOccurred() now requires to hold the GIL: PyOS_Readline() crash

2020-06-01 Thread STINNER Victor


STINNER Victor  added the comment:

> PyOS_InterruptOccurred() now requires to hold the GIL

This change impacted gdb:

* https://sourceware.org/pipermail/gdb-patches/2020-May/169110.html
* https://bugzilla.redhat.com/show_bug.cgi?id=1829702

gdbpy_check_quit_flag() called PyOS_InterruptOccurred() without holding the 
GIL. It worked in Python 3.8, but started to crash in Python 3.9 beta1.

gdb had another issue, it started by always releasing the GIL and always called 
the Python C API with the GIL released (if I understood correctly).

gdb was fixed by calling PyGILState_Ensure()/PyGILState_Release() when calling 
the Python C API, especially PyOS_InterruptOccurred().

Maybe the minimum would be to *document* that the GIL must be held to call 
PyOS_InterruptOccurred(), and that it's not a new requirements.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40826] PyOS_InterruptOccurred() now requires to hold the GIL: PyOS_Readline() crash

2020-06-01 Thread STINNER Victor


Change by STINNER Victor :


--
title: Segfaults when close file descriptor 0 -> PyOS_InterruptOccurred() now 
requires to hold the GIL: PyOS_Readline() crash

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40826] Segfaults when close file descriptor 0

2020-06-01 Thread STINNER Victor


STINNER Victor  added the comment:

The following change modified PyOS_InterruptOccurred() to require the hold the 
GIL:

commit d83168854e19d0381fa57db25fca6c622917624f
Author: Victor Stinner 
Date:   Fri Mar 20 14:50:35 2020 +0100

bpo-40010: Optimize pending calls in multithreaded applications (GH-19091)

If a thread different than the main thread schedules a pending call
(Py_AddPendingCall()), the bytecode evaluation loop is no longer
interrupted at each bytecode instruction to check for pending calls
which cannot be executed. Only the main thread can execute pending
calls.

Previously, the bytecode evaluation loop was interrupted at each
instruction until the main thread executes pending calls.

* Add _Py_ThreadCanHandlePendingCalls() function.
* SIGNAL_PENDING_CALLS() now only sets eval_breaker to 1 if the
  current thread can execute pending calls. Only the main thread can
  execute pending calls.

--

PyOS_InterruptOccurred() is part of the limited C API, but it's not even 
documented :-( So it's not easy to say if it's a backward incompatible change. 
At least, as the author of the change, I can say that the change was deliberate.

bpo-40010 rationale is that only the main thread of the main interpreter must 
call Python signal handlers. So when another thread or another interpreter 
(running the main thread) asks "should the Python signal handlers be executed", 
the answer is always "no", even if yes, Python got a signal (which requires to 
execute at least one Python signal handler).

The change is that PyOS_InterruptOccurred() now requires to hold the GIL to get 
current Python thread state: _PyThreadState_GET() returns NULL when the GIL is 
released.

Modifying PyOS_InterruptOccurred() to always return 0 if the GIL is released 
(if _PyThreadState_GET() returns NULL) is wrong: if the function is called by 
the main thread of the main interpreter, it must return 1.

--

By the way, I rewrote the C signal handler in Python 3.9 to not require to get 
the current Python thread state. In Python 3.8, it was modified and started to 
require the current Python thread if writing into the wakeup file descriptor 
failed to schedule a "pending call".

commit b54a99d6432de93de85be2b42a63774f8b4581a0
Author: Victor Stinner 
Date:   Wed Apr 8 23:35:05 2020 +0200

bpo-40082: trip_signal() uses the main interpreter (GH-19441)

Fix the signal handler: it now always uses the main interpreter,
rather than trying to get the current Python thread state.

The following function now accepts an interpreter, instead of a
Python thread state:

* _PyEval_SignalReceived()
* _Py_ThreadCanHandleSignals()
* _PyEval_AddPendingCall()
* COMPUTE_EVAL_BREAKER()
* SET_GIL_DROP_REQUEST(), RESET_GIL_DROP_REQUEST()
* SIGNAL_PENDING_CALLS(), UNSIGNAL_PENDING_CALLS()
* SIGNAL_PENDING_SIGNALS(), UNSIGNAL_PENDING_SIGNALS()
* SIGNAL_ASYNC_EXC(), UNSIGNAL_ASYNC_EXC()

Py_AddPendingCall() now uses the main interpreter if it fails to the
current Python thread state.

Convert _PyThreadState_GET() and PyInterpreterState_GET_UNSAFE()
macros to static inline functions.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40838] inspect.getsourcefile documentation doesn't mention it can return None

2020-06-01 Thread Jim Fasarakis-Hilliard


Jim Fasarakis-Hilliard  added the comment:

For a more comprehensive list, we currently have for `get*` functions in 
`inspect`:

`inspect.getdoc`: Returns `None` if the documentation string isn't present, 
either directly on the object or through it mro. This *isn't* documented.

`inspect.getfile`: Explicitly seems to handle None cases. After peeking a bit 
in the `PyCode_*` interface, it doesn't seem to be possible to assign `None` to 
the `co_filename` so the returning the `object.co_filename` in the function 
appears to not be able to return `None`.

`inspect.getmodule`: Returns None in a number of cases. This *isn't* documented.

`inspect.getsourcefile`: Returns None if the filename indicates an extension 
module or when none of the ifs are matched. This *isn't* documented.

Some (getmodulename, getcomments) do document this. Agreed that the rest of the 
cases where `None`s might be returned should be documented.

--
nosy: +Jim Fasarakis-Hilliard

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40838] inspect.getsourcefile documentation doesn't mention it can return None

2020-06-01 Thread Pekka Klärck

New submission from Pekka Klärck :

The docs of inspect.getsourcefile [1] mention the function can raise TypeError, 
but there's nothing about the function possibly returning None. This caused a 
bug in our project [2].

If I understand the code [3] correctly, None is returned if getsourcefile 
cannot determine the original source file of the file returned by getfile. 
That's understandable but should definitely be documented. Raising TypeError 
that getfile itself may raise might be even better, but such a backwards 
incompatible API change is probably not worth the effort.

While looking at the code, I also noticed there's getabsfile [4] that uses 
getfile if getsourcefile returns None. That looks handy but since the function 
isn't included in the inspect module documentation [5] using it feels pretty 
risky.

[1] https://docs.python.org/3/library/inspect.html#inspect.getsourcefile
[2] https://github.com/robotframework/robotframework/issues/3587
[3] https://github.com/python/cpython/blob/3.8/Lib/inspect.py#L692
[4] https://github.com/python/cpython/blob/3.8/Lib/inspect.py#L714
[5] https://bugs.python.org/issue12317

--
messages: 370547
nosy: pekka.klarck
priority: normal
severity: normal
status: open
title: inspect.getsourcefile documentation doesn't mention it can return None

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40831] Wrong statement that bytes paths are deprecated under Windows regarding MAX_PATH docs

2020-06-01 Thread Zackery Spytz


Zackery Spytz  added the comment:

I have created a fix for this issue.  Please consider taking a look.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40831] Wrong statement that bytes paths are deprecated under Windows regarding MAX_PATH docs

2020-06-01 Thread Zackery Spytz


Change by Zackery Spytz :


--
keywords: +patch
nosy: +ZackerySpytz
nosy_count: 5.0 -> 6.0
pull_requests: +19810
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/20570

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40830] Certain uses of dictionary unpacking raise TypeError

2020-06-01 Thread miss-islington


Change by miss-islington :


--
keywords: +patch
nosy: +miss-islington
nosy_count: 3.0 -> 4.0
pull_requests: +19809
pull_request: https://github.com/python/cpython/pull/20569

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38144] Add the root_dir and dir_fd parameters in glob.glob()

2020-06-01 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

After adding this feature to iglob I am going to add it to other functions 
which work recursively with a directory tree.

The only question: should we add two parameters root_dir and dir_fd or combine 
them in a single rood_dir (which can be either path or file descriptor or a 
special object combining a file descriptor and a relative path)? Or maybe merge 
one variant, test it and change it before feature freeze if needed?

--
versions: +Python 3.10 -Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22167] iglob() has misleading documentation (does indeed store names internally)

2020-06-01 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Brilliant idea! I played with it yesterday, and it is easy to generalize it to 
work with a*/b*/c*/d/e/f and to "use not more than N simultaneously opened file 
descriptors per glob iterator". The only problem is if we want to use this idea 
with recursive "**" without losing performance. It is just a technical problem 
which can be solved by adding more code. Although I need to do some benchmarks.

And I need to test how this idea will work with issue38144.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40831] Wrong statement that bytes paths are deprecated under Windows regarding MAX_PATH docs

2020-06-01 Thread Steve Dower


Steve Dower  added the comment:

Python now decodes bytes back into a str when used as a path, so the behaviour 
is identical.

Someone else might feel comfortable doing the patch, I didn't mean to imply 
that you had to. Only that it is a valid fix and won't be a waste of time.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40790] Python should enable computed gotos on Mac by default

2020-06-01 Thread laike9m


laike9m  added the comment:

You're right. The part I don't understand is how `--without-computed-gotos`
disabled the feature. Also I guess since this feature is meant to be
transparent to users, it's ok to not have a way to inspect it.

On Mon, Jun 1, 2020 at 12:51 AM Ronald Oussoren 
wrote:

>
> Ronald Oussoren  added the comment:
>
> Looking at the source code at <
> https://github.com/python/cpython/blob/a871f692b4a2e6c7d45579693e787edc0af1a02c/Python/ceval.c#L1024>:
> computed gotos are enabled automatically when they are available.
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40790] Python should enable computed gotos on Mac by default

2020-06-01 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

Looking at the source code at 
:
 computed gotos are enabled automatically when they are available.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40836] logging.fatal() and logging.Logger.fatal() should raise a DeprecationWarning

2020-06-01 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

Thanks, I was wondering about that. I didn't know what is the status of the 
function exactly and found https://bugs.python.org/msg344080.

While they are not documented, you can find them in dir() and in the help, 
maybe they should have a docstring?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40217] The garbage collector doesn't take in account that objects of heap allocated types hold a strong reference to their type

2020-06-01 Thread Petr Viktorin


Change by Petr Viktorin :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39189] Use io.DEFAULT_BUFFER_SIZE for filecmp BUFSIZE variable

2020-06-01 Thread Bahram Aghaei

Bahram Aghaei  added the comment:

Well, I think because the io module provides Python’s main facilities for 
dealing with various types of I/O, so using io.DEFAULT_BUFFER_SIZE is a kind of 
standard buffer size. I don't see any scientific reason for choosing the 8 * 
1024 inside the filecmp module.

My guess is that guy wanted to use something that is fairly small and would be 
okay in different circumstances (OSs) and the idea of DEFAULT_BUFFER_SIZE is 
the same thing.

I think, the chances are high that in the future as computers reinforce, we 
might change the buffer size as well. So using the io.DEFAULT_BUFFER_SIZE will 
guarantee that we only change io.DEFAULT_BUFFER_SIZE and every module would be 
okay automatically?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30008] OpenSSL 1.1.0 deprecated functions

2020-06-01 Thread miss-islington


miss-islington  added the comment:


New changeset 24a88b008b075bca4494822cc7549c10868ab820 by Miss Islington (bot) 
in branch '3.9':
bpo-30008: Fix OpenSSL no-deprecated compilation (GH-20397)
https://github.com/python/cpython/commit/24a88b008b075bca4494822cc7549c10868ab820


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30008] OpenSSL 1.1.0 deprecated functions

2020-06-01 Thread miss-islington


miss-islington  added the comment:


New changeset 9c0ff178a5d5d0992c0be21a7f343a495338ad73 by Miss Islington (bot) 
in branch '3.8':
bpo-30008: Fix OpenSSL no-deprecated compilation (GH-20397)
https://github.com/python/cpython/commit/9c0ff178a5d5d0992c0be21a7f343a495338ad73


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30008] OpenSSL 1.1.0 deprecated functions

2020-06-01 Thread miss-islington


miss-islington  added the comment:


New changeset 296db8cc2fd089d0d2f23b7dddafc029be9f1eb6 by Miss Islington (bot) 
in branch '3.7':
bpo-30008: Fix OpenSSL no-deprecated compilation (GH-20397)
https://github.com/python/cpython/commit/296db8cc2fd089d0d2f23b7dddafc029be9f1eb6


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30008] OpenSSL 1.1.0 deprecated functions

2020-06-01 Thread miss-islington


Change by miss-islington :


--
pull_requests: +19807
pull_request: https://github.com/python/cpython/pull/20566

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30008] OpenSSL 1.1.0 deprecated functions

2020-06-01 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 9.0 -> 10.0
pull_requests: +19806
pull_request: https://github.com/python/cpython/pull/20565

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30008] OpenSSL 1.1.0 deprecated functions

2020-06-01 Thread miss-islington


Change by miss-islington :


--
pull_requests: +19808
pull_request: https://github.com/python/cpython/pull/20567

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30008] OpenSSL 1.1.0 deprecated functions

2020-06-01 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset a871f692b4a2e6c7d45579693e787edc0af1a02c by Christian Heimes in 
branch 'master':
bpo-30008: Fix OpenSSL no-deprecated compilation (GH-20397)
https://github.com/python/cpython/commit/a871f692b4a2e6c7d45579693e787edc0af1a02c


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40788] Build issue Solaris 10 Sparc

2020-06-01 Thread Warren Hardy


Warren Hardy  added the comment:

this error log contains information not piped to the make.log

--
Added file: https://bugs.python.org/file49209/make.error.log

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40788] Build issue Solaris 10 Sparc

2020-06-01 Thread Warren Hardy


Warren Hardy  added the comment:

make log

--
Added file: https://bugs.python.org/file49208/make.log

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com