[issue43497] SyntaxWarning for "assertion is always true, perhaps remove parentheses?" does not work with constants

2021-03-15 Thread Greg Darke


New submission from Greg Darke :

The following block of code does not produce a SyntaxWarning in python 3.7 and 
above (it does produce a warning in python 3.6 and below):

```
assert(False, 'msg')
```

If the tuple is not a constant (for example `(x, 'msg')`), then a warning is 
still produced.

--
components: Interpreter Core
messages: 388711
nosy: darke2
priority: normal
severity: normal
status: open
title: SyntaxWarning for "assertion is always true, perhaps remove 
parentheses?" does not work with constants
type: behavior
versions: Python 3.10, Python 3.7, 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



[issue43497] SyntaxWarning for "assertion is always true, perhaps remove parentheses?" does not work with constants

2021-03-15 Thread Greg Darke


Change by Greg Darke :


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

___
Python tracker 

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



[issue25625] "chdir" Contex manager for pathlib

2021-03-15 Thread 4-launchpad-kalvdans-no-ip-org


Change by 4-launchpad-kalvdans-no-ip-org :


--
nosy: +4-launchpad-kalvdans-no-ip-org

___
Python tracker 

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



[issue43498] "dictionary changed size during iteration" error in _ExecutorManagerThread

2021-03-15 Thread Jakub Kulik


New submission from Jakub Kulik :

Recently several of our Python 3.9 builds froze during `make install` with the 
following trace in logs:

Listing 
.../components/python/python39/build/prototype/sparc/usr/lib/python3.9/lib2to3/tests/data/fixers/myfixes...
Exception in thread Thread-1:
Traceback (most recent call last):
  File 
".../components/python/python39/build/prototype/sparc/usr/lib/python3.9/threading.py",
 line 954, in _bootstrap_inner
self.run()
  File 
".../components/python/python39/build/prototype/sparc/usr/lib/python3.9/concurrent/futures/process.py",
 line 317, in run
result_item, is_broken, cause = self.wait_result_broken_or_wakeup()
  File 
".../components/python/python39/build/prototype/sparc/usr/lib/python3.9/concurrent/futures/process.py",
 line 376, in wait_result_broken_or_wakeup
worker_sentinels = [p.sentinel for p in self.processes.values()]
  File 
".../components/python/python39/build/prototype/sparc/usr/lib/python3.9/concurrent/futures/process.py",
 line 376, in 
worker_sentinels = [p.sentinel for p in self.processes.values()]
RuntimeError: dictionary changed size during iteration

After this, the build freezes and never ends (most likely waiting for the 
broken thread).

We see this only in Python 3.9 (3.7 doesn't seem to be affected, and we don't 
deliver other versions) and only when doing full builds of the entire Userland, 
meaning that this might be related to big utilization of the build machine? 
That said, it only happened three or four times, so this might be just a 
coincidence.

Simple fix seems to be this (PR shortly):

--- Python-3.9.1/Lib/concurrent/futures/process.py
+++ Python-3.9.1/Lib/concurrent/futures/process.py
@@ -373,7 +373,7 @@ class _ExecutorManagerThread(threading.T
 assert not self.thread_wakeup._closed
 wakeup_reader = self.thread_wakeup._reader
 readers = [result_reader, wakeup_reader]
-worker_sentinels = [p.sentinel for p in self.processes.values()]
+worker_sentinels = [p.sentinel for p in self.processes.copy().values()]
 ready = mp.connection.wait(readers + worker_sentinels)
 
 cause = None


This is on Oracle Solaris and on both SPARC and Intel machines.

--
components: Installation, asyncio
messages: 388712
nosy: asvetlov, kulikjak, yselivanov
priority: normal
severity: normal
status: open
title: "dictionary changed size during iteration" error in 
_ExecutorManagerThread
type: crash
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



[issue43498] "dictionary changed size during iteration" error in _ExecutorManagerThread

2021-03-15 Thread Jakub Kulik


Change by Jakub Kulik :


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

___
Python tracker 

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



[issue24498] Should ptags and eptags be removed from repo?

2021-03-15 Thread Zackery Spytz


Change by Zackery Spytz :


--
keywords: +patch
nosy: +ZackerySpytz
nosy_count: 1.0 -> 2.0
pull_requests: +23631
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/24869

___
Python tracker 

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



[issue43483] Loss of content in simple (but oversize) SAX parsing

2021-03-15 Thread Eric V. Smith


Eric V. Smith  added the comment:

Perhaps you could open a documentation bug? I think specific examples of where 
the documentation is wrong, and how it could be improved, would be helpful.

Thanks!

--
nosy: +eric.smith

___
Python tracker 

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



[issue43181] Python macros don’t shield arguments

2021-03-15 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

> As I wrote previously, I dislike macros. If someone is changed, I would 
> prefer to convert the function into a static inline function which doesn't 
> have macros pitfalls.

Should we create a meta issue for this? Most macros are trivial, and can safely 
be converted, given that they're not used as l-values. Converting one header 
file at the time would make it easy to review, and it would be possible to make 
good progress in a few months time.

--

___
Python tracker 

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



[issue42917] Block stack size for frame objects should be dynamically sizable

2021-03-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

> There are also other ideas floating about for improving memory locality 
> related to the frame stack, e.g. putting the stack frames in an array instead 
> of a linked list.

Would it work with generators and coroutines?

--

___
Python tracker 

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



[issue43497] SyntaxWarning for "assertion is always true, perhaps remove parentheses?" does not work with constants

2021-03-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

What is the use case for assert with a constant?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue43475] Worst-case behaviour of hash collision with float NaN

2021-03-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

What about Decimal NaN? Even if make float NaN a singleton, there will be other 
NaNs.

And making float('nan') returning a singleton, but 1e1000 * 0 returning 
different NaN would cause large confusion.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue43497] SyntaxWarning for "assertion is always true, perhaps remove parentheses?" does not work with constants

2021-03-15 Thread Greg Darke


Greg Darke  added the comment:

I would argue that there is none (especially if it is tuple/something that is 
always true) -- thus why I would assume that Python would provide a warning.

This bug comes from a discussion I was having with someone earlier today where 
they mentioned that it would be nice if the linter complained about the 
following::

  assert 'not reachable'

That code is incorrect (the assertion will never fire, due to the string 
evaluating to True). We remembered that python did complain about tuples, and 
tried to see what the warning looked like using a trivial example::

  assert(False, 'msg')

We noticed that this code did not produce a warning on python3.8, but did 
produce a warning on python2.7.

After much digging we found that the following did work on python3.8::

  assert(False, str())

This allowed us to deduce that something special was happening with constants 
(well, it also required us to look at the disassembly of the ops codes for the 
above two statements).

Going back to your original question, I have used `assert False` in code to 
"test" if a piece of code was being reached. I have also used it for things 
similar to the piece of code that started all of this::

  if some_expression:
# ...
  elif some_other_expression:
#...
  else:
assert False, 'This code is unreachable'

--

___
Python tracker 

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



[issue43496] Save As dialog in IDLE doesn't accept keyboard shortcuts on MacOS

2021-03-15 Thread E. Paine


E. Paine  added the comment:

This is reproducible using tkinter in Python 3.9.2 installed using both the 
regular Intel and Universal2 installers. It is also reproducible in Wish 
8.6.10. (tested on MacOS 11.2.1)

--
components:  -IDLE
nosy: +epaine

___
Python tracker 

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



[issue1103350] send/recv SEGMENT_SIZE should be used more in socketmodule

2021-03-15 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

FYI, the SEGMENT_SIZE define was removed by 
af01f668173d4061893148b54a0f01b91c7716c2 (bpo-16136).

--
nosy: +erlendaasland

___
Python tracker 

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



[issue43334] venv does not install libpython

2021-03-15 Thread Vinay Sajip


Vinay Sajip  added the comment:

This is not a bug - venvs are primarily *run*-time (as opposed to 
development-time) environments, into which you install pre-built Python 
packages (including ones with C extensions). Can you give a specific example 
where creating a venv and installing packages into it leads to a problem due to 
libpython.XXX being unavailable, with a series of steps to reproduce? If not, 
this issue will need to be closed.

--
status: open -> pending

___
Python tracker 

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



[issue37820] Unnecessary URL scheme exists to allow 'URL: reading file in urllib

2021-03-15 Thread Christian Heimes


Christian Heimes  added the comment:

It's a Python 2-only problem. Python 2 no longer receives security fixes. 
Please update to a supported version of Python or report the issue with your 
vendor.

--
nosy: +christian.heimes
resolution:  -> wont fix
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



[issue43497] SyntaxWarning for "assertion is always true, perhaps remove parentheses?" does not work with constants

2021-03-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

In such case I prefer to write

assert not 'reachable'

It is shorter than writing False.

If I want to keep an exception even with -O, I write

raise AssertionError

--

___
Python tracker 

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



[issue43334] venv does not install libpython

2021-03-15 Thread Christian Heimes


Christian Heimes  added the comment:

I agree with Vinay. venvs don't contain copies of libpython or header files by 
design. setuptools will pcik them up from the main installation.

If you have any issues with compiling C extensions, please report them with 
setuptools at https://github.com/pypa/setuptools/

--
nosy: +christian.heimes
resolution:  -> not a bug
stage:  -> resolved
status: pending -> closed

___
Python tracker 

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



[issue12777] Inconsistent use of VOLUME_NAME_* with GetFinalPathNameByHandle

2021-03-15 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

This seems to have been fixed in 2018 in bpo-33016 by GH-6010.

--
nosy: +erlendaasland

___
Python tracker 

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



[issue37820] Unnecessary URL scheme exists to allow 'URL: reading file in urllib

2021-03-15 Thread Miro Hrončok

Change by Miro Hrončok :


--
nosy: +hroncok
nosy_count: 3.0 -> 4.0
pull_requests: +23632
pull_request: https://github.com/python/cpython/pull/24870

___
Python tracker 

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



[issue15698] PEP 3121, 384 Refactoring applied to pyexpat module

2021-03-15 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

Fixed by GH-2.

--
nosy: +erlendaasland, vstinner

___
Python tracker 

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



[issue39100] email.policy.SMTP throws AttributeError on invalid header

2021-03-15 Thread Anton Khirnov


Change by Anton Khirnov :


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

___
Python tracker 

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



[issue43181] Python macros don’t shield arguments

2021-03-15 Thread STINNER Victor


STINNER Victor  added the comment:

If possible, I would prefer to only replace macros with static inline functions 
if the changes avoids clear macro pitfalls. It's not because macros have 
pitfalls that we must replace them all blindly.

Also, this issue is closed. At this point, I'm not convinced that it's worth it 
to fix PyObject_TypeCheck() in Python 3.8 and 3.9, so I leave the issue closed.

--

___
Python tracker 

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



[issue27929] asyncio.AbstractEventLoop.sock_connect broken for AF_BLUETOOTH

2021-03-15 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



[issue15698] PEP 3121, 384 Refactoring applied to pyexpat module

2021-03-15 Thread STINNER Victor


Change by STINNER Victor :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Py_Finalize() doesn't clear all Python objects at exit

___
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

2021-03-15 Thread STINNER Victor


STINNER Victor  added the comment:

I marked bpo-15698 "PEP 3121, 384 Refactoring applied to pyexpat module" as a 
duplicate of this issue.

--

___
Python tracker 

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



[issue37741] importlib.metadata docs not showing up in the module index

2021-03-15 Thread Miro Hrončok

Miro Hrončok  added the comment:

The docs at https://docs.python.org/3/library/importlib.metadata.html also 
don't list the API at all, it is just a tutorial, not a reference. I see the 
code has docstrings, but they are missing from the docs. E.g. 
PackageNotFoundError is not documented at all.

--
nosy: +hroncok

___
Python tracker 

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



[issue43181] Python macros don’t shield arguments

2021-03-15 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

> If possible, I would prefer to only replace macros with static inline 
> functions if the changes avoids clear macro pitfalls.

Yes, of course. Should I create a meta issue for this, or do you prefer raising 
one issue pr. fix?

--

___
Python tracker 

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



[issue43499] Compiler warnings in building Python 3.9 on Windows

2021-03-15 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

Currently building Python 3.9 on Windows produce many compiler warnings. 3.8 
and master are clean.

* Warnings in the _sre module caused by the bug in MSVC (complains about 
automatic conversion of "void **" to "const void *"). Fixed by backporting 
PR20508.

* Warnings in many files related to using legacy C API (e.g. 
PyUnicode_AsUnicode) in Windows specific code.

* ..\Objects\exceptions.c(2313): warning C4098: 'MemoryError_dealloc': 'void' 
function returning a value

* ..\Objects\frameobject.c(400): warning C4267: 'initializing': conversion from 
'size_t' to 'int', possible loss of data

The last two may be hidden bugs.

--
components: Extension Modules, Interpreter Core
messages: 388731
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: Compiler warnings in building Python 3.9 on Windows
versions: Python 3.9

___
Python tracker 

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



[issue43499] Compiler warnings in building Python 3.9 on Windows

2021-03-15 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue43500] Add filtercase() into fnmatch

2021-03-15 Thread wyz23x2


New submission from wyz23x2 :

The fnmatch module has a filter() function:
> Construct a list from those elements of the iterable names that match pattern.
> It is the same as [n for n in names if fnmatch(n, pattern)], but implemented 
> more efficiently.
However, since there is the fnmatchcase() function, we should have filtercase() 
too.

--
components: Library (Lib)
messages: 388732
nosy: wyz23x2
priority: normal
severity: normal
status: open
title: Add filtercase() into fnmatch
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



[issue43500] Add filtercase() into fnmatch

2021-03-15 Thread wyz23x2


Change by wyz23x2 :


--
type:  -> enhancement

___
Python tracker 

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



[issue43223] [security] http.server: Open Redirection if the URL path starts with //

2021-03-15 Thread Hamza Avvan


Change by Hamza Avvan :


--
hgrepos: +404

___
Python tracker 

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



[issue43181] Python macros don’t shield arguments

2021-03-15 Thread STINNER Victor


STINNER Victor  added the comment:

You can create a single issue, and later we will see if it's needed to split it 
into sub-issues.

--

___
Python tracker 

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



[issue43313] feature: support pymalloc for subinterpreters. each subinterpreter has pymalloc_state

2021-03-15 Thread junyixie


junyixie  added the comment:

There is a problem:
if we bound pymalloc state with a interpreter.
malloc pointer in interpreterA and free pointer is usual.

it's cause a problem. 
when we use PyObject_Free, 
1. we look up address in pymalloc pool.
2. if not find, current code will call PyMem_RawFree(p) to free. it will cause 
crash.(address is pymalloc_alloc from another interpreter)

I think it has two way to slove this problem:
1. free/alloc memory in one interpreter. Frequent switch interpreter affects 
performance
2. when free memory address, find this address in all interpreter pymalloc 
pool. and free it.(but it need add lock to pymalloc)

--

___
Python tracker 

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



[issue43313] feature: support pymalloc for subinterpreters. each subinterpreter has pymalloc_state

2021-03-15 Thread junyixie


junyixie  added the comment:

> malloc pointer in interpreterA and free pointer is usual.

malloc pointer in interpreterA and free pointer in interpreterB is usual.

--

___
Python tracker 

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



[issue43313] feature: support pymalloc for subinterpreters. each subinterpreter has pymalloc_state

2021-03-15 Thread junyixie


junyixie  added the comment:

by the way, 
There is no operation to destroy the memory pool in the cpython code. Repeated 
creation of the pymalloc pool will cause memory leaks.

--

___
Python tracker 

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



[issue43313] feature: support pymalloc for subinterpreters. each subinterpreter has pymalloc_state

2021-03-15 Thread junyixie


junyixie  added the comment:

> 2. when free memory address, find this address in all interpreter pymalloc 
> pool. and free it.(but it need add lock to pymalloc)

when finalize_interp_delete, we need keep interpreter pymalloc pool in linked 
list.It will be used when search memory in pymalloc pools.

--

___
Python tracker 

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



[issue43501] email._header_value_parse throws AttributeError on display name ending with dot

2021-03-15 Thread Anton Khirnov


New submission from Anton Khirnov :

On parsing an email where the display name in an address ends on a dot 
immediately followed by angle-addr, accessing the resulting mailbox 
display_name throws
/usr/lib/python3.9/email/_header_value_parser.py in value(self)
589 if self[0].token_type=='cfws' or 
self[0][0].token_type=='cfws':
590 pre = ' '
--> 591 if self[-1].token_type=='cfws' or 
self[-1][-1].token_type=='cfws':
592 post = ' '
593 return pre+quote_string(self.display_name)+post

AttributeError: 'str' object has no attribute 'token_type'

The problem is that self[-1] is the terminal DOT.

An example of the problematic header is:
From: foobar.

--
components: email
messages: 388738
nosy: barry, elenril, r.david.murray
priority: normal
severity: normal
status: open
title: email._header_value_parse throws AttributeError on display name ending 
with dot
type: behavior
versions: Python 3.10, Python 3.6, Python 3.7, 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



[issue43501] email._header_value_parse throws AttributeError on display name ending with dot

2021-03-15 Thread Anton Khirnov


Change by Anton Khirnov :


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

___
Python tracker 

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



[issue43502] [C-API] Convert obvious unsafe macros to static inline functions

2021-03-15 Thread Erlend Egeberg Aasland


New submission from Erlend Egeberg Aasland :

Convert macros to static inline functions if...:
- the macro contains a clear pitfall (for example "duplication of side effects")
- the fix is trivial
- the macro is not used as an l-value (for example Py_TYPE())


See also:
- https://gcc.gnu.org/onlinedocs/cpp/Macro-Pitfalls.html
- bpo-43181
- bpo-39573
- bpo-40170

--
components: C API
messages: 388739
nosy: corona10, erlendaasland, vstinner
priority: normal
severity: normal
status: open
title: [C-API] Convert obvious unsafe macros to static inline functions
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



[issue43502] [C-API] Convert obvious unsafe macros to static inline functions

2021-03-15 Thread STINNER Victor


STINNER Victor  added the comment:

For me, one of the my worst issue is when a macro evalutes an argument twice.

Example:
---
#include 

#define DOUBLE(value) ((value) + (value))

int main()
{
int x = 1;
// expanded to: ((++x) + (++x))
int y = DOUBLE(++x);
printf("x=%i y=%i\n", x, y);
return 0;
}
---

Surprising output:
---
$ gcc x.c -o x; ./x
x=3 y=6
---

Expected output:
---
x=2 y=4
---

Fixed code using a static inline function:
---
#include 

static inline int DOUBLE(int value) {
return value + value;
}

int main()
{
int x = 1;
// expanded to: DOUBLE(++x)
int y = DOUBLE(++x);
printf("x=%i y=%i\n", x, y);
return 0;
}
---

Output:
---
$ gcc x.c -o x; ./x
x=2 y=4
---

--

___
Python tracker 

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



[issue43502] [C-API] Convert obvious unsafe macros to static inline functions

2021-03-15 Thread STINNER Victor


STINNER Victor  added the comment:

I would add that we should pay attention to:

* not introducing a backward incompatible C API change by mistake
* not introducing new compiler warnings.

A common source of warning is that macros have no type for their arguments or 
return value, whereas static inline functions are strictly types. A common 
pattern in the Python header file is to use _PyObject_CAST() or 
_PyObject_CONST_CAST(). Example:

#define _PyObject_CAST(op) ((PyObject*)(op))
#define _PyObject_CAST_CONST(op) ((const PyObject*)(op))

static inline void _Py_INCREF(PyObject *op) { (...) }
#define Py_INCREF(op) _Py_INCREF(_PyObject_CAST(op))

For macros of the *internal* C API, it's ok to becom more strict about types. 
For example, in the *public* C API, I replaced:

#define PyObject_INIT(op, typeobj) \
( Py_TYPE(op) = (typeobj), _Py_NewReference((PyObject *)(op)), (op) )

with:

PyAPI_FUNC(PyObject *) PyObject_Init(PyObject *, PyTypeObject *);
#define PyObject_INIT(op, typeobj) PyObject_Init(_PyObject_CAST(op), (typeobj))

But for the internal C API, I added:

static inline void _PyObject_Init(PyObject *op, PyTypeObject *typeobj) { ... }

which doesn't cast its arguments.

--

___
Python tracker 

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



[issue43502] [C-API] Convert obvious unsafe macros to static inline functions

2021-03-15 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

Should we try to split all macros like that, if possible?

--

___
Python tracker 

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



[issue43502] [C-API] Convert obvious unsafe macros to static inline functions

2021-03-15 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


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

___
Python tracker 

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



[issue43313] feature: support pymalloc for subinterpreters. each subinterpreter has pymalloc_state

2021-03-15 Thread STINNER Victor


STINNER Victor  added the comment:

I'm not sure that it's needed to have a "per interpreter" allocator. The needed 
feature is to be able to call PyMem_Malloc() in parallel in different threads. 
If I understood correctly, the glibc malloc has a per-thread fast allocator (no 
locking) and then falls back to a slow allocator (locking) if the fast 
allocator failed. Maybe pymalloc could have per-thread memory arenas.

When I implemented the PEP 587, I spend a significant amount of time to avoid 
using pymalloc before Py_Initialize() is called: only use PyMem_RawMalloc() 
before Py_Initialize().

But I'm not 100% sure that pymalloc is not used before Py_Initialize() nor 
*after* Py_Finalize(). For example, we should check if a daemon thread can call 
PyMem_Malloc() after Py_Finalize(), even if they are supposed to exit as soon 
as they try to acquire the GIL, even the GIL must be held to use pymalloc (to 
use PyMem_Malloc and PyObject_Malloc):
https://docs.python.org/dev/c-api/memory.html#memory-interface

See also bpo-37448:
"Add radix tree implementation for obmalloc address_in_range()"
https://github.com/python/cpython/pull/14474

--

___
Python tracker 

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



[issue37448] obmalloc: radix tree for tracking arena address ranges

2021-03-15 Thread STINNER Victor


STINNER Victor  added the comment:

See also bpo-43313: "feature: support pymalloc for subinterpreters. each 
subinterpreter has pymalloc_state".

--
nosy: +vstinner

___
Python tracker 

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



[issue43313] feature: support pymalloc for subinterpreters. each subinterpreter has pymalloc_state

2021-03-15 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +methane, nascheme

___
Python tracker 

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



[issue43313] feature: support pymalloc for subinterpreters. each subinterpreter has pymalloc_state

2021-03-15 Thread STINNER Victor


STINNER Victor  added the comment:

The current workaround is to disable pymalloc when Python is built with 
EXPERIMENTAL_ISOLATED_SUBINTERPRETERS:

_PyPreConfig_InitCompatConfig(PyPreConfig *config):

#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
/* bpo-40512: pymalloc is not compatible with subinterpreters,
   force usage of libc malloc() which is thread-safe. */
#ifdef Py_DEBUG
config->allocator = PYMEM_ALLOCATOR_MALLOC_DEBUG;
#else
config->allocator = PYMEM_ALLOCATOR_MALLOC;
#endif
#else
...
#endif

--

___
Python tracker 

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



[issue40512] [subinterpreters] Meta issue: per-interpreter GIL

2021-03-15 Thread STINNER Victor


STINNER Victor  added the comment:

> * Add a lock to pymalloc, or disable pymalloc when subinterpreters are used: 
> https://github.com/ericsnowcurrently/multi-core-python/issues/30

See bpo-43313: "feature: support pymalloc for subinterpreters. each 
subinterpreter has pymalloc_state".

--

___
Python tracker 

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



[issue42917] Block stack size for frame objects should be dynamically sizable

2021-03-15 Thread Guido van Rossum


Guido van Rossum  added the comment:

Yes, if we keep the top of the stack and the current frame in separate
variables.--
--Guido (mobile)

--

___
Python tracker 

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



[issue43475] Worst-case behaviour of hash collision with float NaN

2021-03-15 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> And making float('nan') returning a singleton, 
> but 1e1000 * 0 returning different NaN would cause large confusion.

Not really, it would be just be an implementation detail, no different than int 
and strings being sometimes unique and sometimes not.  Historically, immutable 
objects are allowed to be reused when it is convenient for the implementation.

> What about Decimal NaN?

Decimal isn't used as much, so the need is less pressing, but we can do 
whatever is allowed by the spec.  Presumably, that would be easier than with 
floats because we control all possible ways to construct Decimals.

--

___
Python tracker 

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



[issue43463] typing.get_type_hints with TYPE_CHECKING imports / getting hints for single argument

2021-03-15 Thread Florian Bruhin


Florian Bruhin  added the comment:

Fair points.

As an aside, I'm also wondering how inspect.Parameter.annotation should 
interact with the changes in Python 3.10? That used to be the canonical way (as 
far as I'm aware) of getting a single argument's type annotation (other than 
getting it from __annotations__ manually), but with PEP 563 now would always 
return a (probably not very useful?) string.

--

___
Python tracker 

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



[issue43463] typing.get_type_hints with TYPE_CHECKING imports / getting hints for single argument

2021-03-15 Thread Guido van Rossum


Guido van Rossum  added the comment:

Please open a separate issue for that.

--

___
Python tracker 

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



[issue43463] typing.get_type_hints with TYPE_CHECKING imports / getting hints for single argument

2021-03-15 Thread Ken Jin


Ken Jin  added the comment:

@Florian,

IIUC inspect.signature auto-resolves string annotations to typing.ForwardRef 
internally from 3.10 onwards. It's mentioned in the what's new for PEP 563 
https://docs.python.org/3.10/whatsnew/3.10.html#pep-563-postponed-evaluation-of-annotations-becomes-default

If it fails, it will just give the string. So the only place where 
inspect.signature might start giving you different output is if you previously 
defined a function like so:

def foo(a: 'MyType'): ...

And you expected inspect.signature.paramters to be ``[]`` (the string). However if MyType is in globals()/locals(), you'll 
instead get ``[]`` in 3.10.

FWIW someone already reported that in Issue43355.

--

___
Python tracker 

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



[issue43496] macOS tkinter Save As doesn't accept keyboard shortcuts

2021-03-15 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Thank you, EP, for being 'someone'.  I should remember that you are the one who 
can current do these tests.  I presume the reproducible 'this' is the 
non-response to cmd-A, cmd-Z, and so on.  So closing as 3rd party, tcl/tk, 
issue.

I comfirmed that Jacob's expectation is reasonable in that the keys do work in 
the macOS save-as dialog opened from Safari (and I presume in other 
Apple-supplied apps).

The tk doc https://www.tcl.tk/man/tcl8.6/TkCmd/getOpenFile.htm says merely "pop 
up a dialog box for the user to select a file to open or save." Some details 
are system-specific.  The only promise about user interaction is that one can 
enter a new name when saving and either confirm or cancel.

The tkinter doc 
https://docs.python.org/3.10/library/dialog.html#module-tkinter.filedialog adds 
"native look-and-feel", but this is an interpretation of the intention of the 
tk function and is completely dependent on them.  Any failure of the 'feel' 
part should be reported to tk.  (The IDLE doc merely says "with a Save As 
dialog".)

The IDLE Edit menu only applies to its editable text windows.  Their menus are 
grayed out for modal dialogs.  Tkinter dialog entry boxes come with selection 
and clipboard hot keys, but not undo keys.

--
resolution:  -> third party
stage:  -> resolved
status: open -> closed
title: Save As dialog in IDLE doesn't accept keyboard shortcuts on MacOS -> 
macOS tkinter Save As doesn't accept keyboard shortcuts

___
Python tracker 

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



[issue43478] Disallow Mock spec arguments from being Mocks

2021-03-15 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue43478] Disallow Mock spec arguments from being Mocks

2021-03-15 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

Lets go ahead and try making this a breaking change in 3.10.  If users report 
it causes a bunch of problems during the beta -that they don't want to address 
so soon- (they are all likely bugs in test suites...) we can soften it to a 
warning for a cycle.  My hope is that we won't need to do that.

--

___
Python tracker 

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



[issue12777] Inconsistent use of VOLUME_NAME_* with GetFinalPathNameByHandle

2021-03-15 Thread Eryk Sun


Eryk Sun  added the comment:

bpo-33016 fixed the problem with the inconsistent dwFlags argument passed to 
GetFinalPathNameByHandleW().

We do need the ability to get the NT name in order to implement samefile() and 
sameopenfile() reliably in all cases -- i.e. when the volume serial number 
and/or file ID are 0 because the filesystem doesn't support them. A new issue 
needs to be opened to extend nt._getfinalpathname() to support passing either a 
file descriptor or a name and to add a parameter for the flags that defaults to 
0.

> VOLUME_NAME_NT was more general purpose

The most broadly supported flags value is `VOLUME_NAME_NT | FILE_NAME_OPENED` 
-- e.g. "\Device\HarddiskVolume2\Windows\Temp\FILENA~1.TXT". 

For general use, the preferred form is `VOLUME_NAME_DOS | FILE_NAME_NORMALIZED` 
(dwFlags=0), which is the canonical DOS path with long component names -- e.g. 
"\\?\C:\Windows\Temp\filename_long.txt". This requires a volume device that 
supports the mountpoint manager; a registered or auto-assigned DOS drive-letter 
name; and a filesystem that supports normalizing names in the opened path.

GetFinalPathNameByHandleW() has special handling for the Multiple UNC Provider 
(MUP) device at the root of UNC paths (i.e. \\server\share -> 
\\?\UNC\server\share -> \Device\Mup\server\share). For the DOS 'volume' name, 
it returns the "\\?\UNC" form.

Caveats

Substitute drives and mapped drives are never present in the final DOS path. 
They resolve to a filesystem directory, not to a volume device, and they're 
usually defined locally in a logon session. Such drives are not final, globally 
accessible paths.

A file/directory in a filesystem is required, such as a filesystem mounted on a 
volume device, the named-pipe filesystem implemented on \Device\NamedPipe, or 
the mailslot filesystem implemented on \Device\Mailslot. Non-filesystem devices 
are not supported, such as \\?\CON (i.e. \Device\ConDrv\Console) and \\?\NUL 
(i.e. \Device\Null).

> That's slightly off-topic, but is it enough to strip the leading
> '\\?\' (and replace 'UNC' with '\')

The \\?\ path prefix, which signifies an extended path (i.e. a verbatim 
local-device path), should not be removed without testing that it results in an 
equivalent, accessible path. An extended path may be required in order to 
access DOS paths that are longer than MAX_PATH. Also, the last path component 
of the final path may be a reserved DOS device name, or end with trailing dots 
and/or spaces, which is inaccessible without using an extended path.

--
nosy: +eryksun
resolution:  -> out of date
stage:  -> resolved
status: open -> closed
superseder:  -> nt._getfinalpathname may use uninitialized memory

___
Python tracker 

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



[issue43478] Disallow Mock spec arguments from being Mocks

2021-03-15 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +cjw296, lisroach, mariocj89, michael.foord

___
Python tracker 

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



[issue43478] Disallow Mock spec arguments from being Mocks

2021-03-15 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

For a simple experiment raising an exception I can see two tests failing in 
test suite that have the pattern of having an autospec which is a mock object.

diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py
index 720f682efb..d33c7899a1 100644
--- a/Lib/unittest/mock.py
+++ b/Lib/unittest/mock.py
@@ -2612,6 +2612,9 @@ def create_autospec(spec, spec_set=False, instance=False, 
_parent=None,
 # interpreted as a list of strings
 spec = type(spec)
 
+if _is_instance_mock(spec):
+1 / 0
+
 is_type = isinstance(spec, type)
 is_async_func = _is_async_func(spec)
 _kwargs = {'spec': spec}


./python -m unittest Lib.unittest.test.testmock
E..E...
==
ERROR: test_bool_not_called_when_passing_spec_arg 
(unittest.test.testmock.testmock.MockTest)
--
Traceback (most recent call last):
  File "/root/cpython/Lib/unittest/test/testmock/testmock.py", line 2180, in 
test_bool_not_called_when_passing_spec_arg
with unittest.mock.patch.object(obj, 'obj_with_bool_func', autospec=True): 
pass
  File "/root/cpython/Lib/unittest/mock.py", line 1503, in __enter__
new = create_autospec(autospec, spec_set=spec_set,
  File "/root/cpython/Lib/unittest/mock.py", line 2616, in create_autospec
1 / 0
ZeroDivisionError: division by zero

==
ERROR: test_create_autospec_awaitable_class 
(unittest.test.testmock.testasync.AsyncAutospecTest)
--
Traceback (most recent call last):
  File "/root/cpython/Lib/unittest/test/testmock/testasync.py", line 204, in 
test_create_autospec_awaitable_class
self.assertIsInstance(create_autospec(awaitable_mock), AsyncMock)
  File "/root/cpython/Lib/unittest/mock.py", line 2616, in create_autospec
1 / 0
ZeroDivisionError: division by zero

--
Ran 495 tests in 2.039s

FAILED (errors=2)

--

___
Python tracker 

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



[issue43463] typing.get_type_hints with TYPE_CHECKING imports / getting hints for single argument

2021-03-15 Thread Florian Bruhin


Florian Bruhin  added the comment:

Ah, I wasn't aware of that, thanks for the pointer! So what inspect does 
internally is:

def _get_type_hints(func, **kwargs):
try:
return typing.get_type_hints(func, **kwargs)
except Exception:
# First, try to use the get_type_hints to resolve
# annotations. But for keeping the behavior intact
# if there was a problem with that (like the namespace
# can't resolve some annotation) continue to use
# string annotations
return func.__annotations__

Which means there's even some "prior art" there already falling back to a 
string when the annotation couldn't be resolved. Doing so in 
typing.get_type_hints on a per-argument basis would thus also make inspect more 
consistent:

Right now,

print(repr(inspect.signature(fun).parameters['b'].annotation))

in my example returns a string, but when changing the annotation for `a`, the 
returned annotation for `b` is now magically a `typing.Union` object.

(I personally would indeed expect inspect to resolve those annotations, but 
yeah, let's keep that in issue43355.)

--

___
Python tracker 

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



[issue43355] __future__.annotations breaks inspect.signature()

2021-03-15 Thread Florian Bruhin


Change by Florian Bruhin :


--
nosy: +The Compiler

___
Python tracker 

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



[issue43285] ftplib should not use the host from the PASV response

2021-03-15 Thread Gregory P. Smith


Gregory P. Smith  added the comment:


New changeset 0ab152c6b5d95caa2dc1a30fa96e10258b5f188e by Gregory P. Smith in 
branch 'master':
bpo-43285 Make ftplib not trust the PASV response. (GH-24838)
https://github.com/python/cpython/commit/0ab152c6b5d95caa2dc1a30fa96e10258b5f188e


--

___
Python tracker 

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



[issue43285] ftplib should not use the host from the PASV response

2021-03-15 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 3.0 -> 4.0
pull_requests: +23638
pull_request: https://github.com/python/cpython/pull/24880

___
Python tracker 

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



[issue43371] Mock.assert_has_calls works strange

2021-03-15 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

https://docs.python.org/3/library/unittest.mock.html#unittest.mock.Mock.assert_has_calls

> If any_order is false then the calls must be sequential. There can be extra 
> calls before or after the specified calls.

One way to check that the calls appear in order even with extra calls in 
between since any_order=False expects the calls to be sequential is to use 
mock_calls which is a list and use index method. It's not very elegant.

>>> from unittest.mock import Mock, call
>>> m = Mock()
>>> m(1)

>>> m(2)

>>> m(3)
 
>>> m.mock_calls.index(call(1))
0
>>> m.mock_calls.index(call(3))
2

> - Mock.assert_has_only_calls that always raise an error when mock has calls 
> other than expected(not regarding any_order).

This sounds like a stricter version of assert_has_calls to ensure expected is 
matched without order with mock_calls and len(expected) == len(mock_calls)

I am not keen on changing behavior of assert_has_calls with any additional 
flags for compatibility but any additional helper should go in python 3.10 
only. So I have updated the version.

--
components: +Library (Lib) -Tests
nosy: +cjw296, lisroach, mariocj89, michael.foord
versions: +Python 3.10 -Python 3.7

___
Python tracker 

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



[issue43285] ftplib should not use the host from the PASV response

2021-03-15 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
pull_requests: +23639
pull_request: https://github.com/python/cpython/pull/24881

___
Python tracker 

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



[issue43498] "dictionary changed size during iteration" error in _ExecutorManagerThread

2021-03-15 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +bquinlan, pitrou

___
Python tracker 

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



[issue43503] [subinterpreters] PyObject statics exposed in the limited API break isolation.

2021-03-15 Thread Eric Snow


New submission from Eric Snow :

In the limited C-API we expose the following static PyObject variables:

* 5 singletons
* ~70 exception types
* ~70 other types

Since they are part of the limited API, they have a direct effect on the stable 
ABI.

The problem is that these objects should not be shared between interpreters.  
There are a number of possible solutions for isolating the objects, but the big 
constraint is that the solution cannot break the stable ABI.

--
components: C API
messages: 388759
nosy: eric.snow
priority: normal
severity: normal
stage: needs patch
status: open
title: [subinterpreters] PyObject statics exposed in the limited API break 
isolation.
type: behavior
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



[issue40255] Fixing Copy on Writes from reference counting

2021-03-15 Thread Eric Snow


Eric Snow  added the comment:

While the eventual solution may overlap, my interests are divergent enough from 
those here that I've created a separate issue: bpo-43503.

--

___
Python tracker 

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



[issue11339] annotation for class being defined

2021-03-15 Thread Socob


Change by Socob <206a8...@opayq.com>:


--
nosy: +Socob

___
Python tracker 

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



[issue43285] ftplib should not use the host from the PASV response

2021-03-15 Thread miss-islington


miss-islington  added the comment:


New changeset 7dcb4baa4f0fde3aef5122a8e9f6a41853ec9335 by Miss Islington (bot) 
in branch '3.9':
bpo-43285 Make ftplib not trust the PASV response. (GH-24838)
https://github.com/python/cpython/commit/7dcb4baa4f0fde3aef5122a8e9f6a41853ec9335


--

___
Python tracker 

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



[issue43285] ftplib should not use the host from the PASV response

2021-03-15 Thread Gregory P. Smith


Gregory P. Smith  added the comment:


New changeset 664d1d16274b47eea6ec92572e1ebf3939a6fa0c by Gregory P. Smith in 
branch '3.8':
[3.8] bpo-43285 Make ftplib not trust the PASV response. (GH-24838) (GH-24881)
https://github.com/python/cpython/commit/664d1d16274b47eea6ec92572e1ebf3939a6fa0c


--

___
Python tracker 

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



[issue43285] ftplib should not use the host from the PASV response

2021-03-15 Thread miss-islington


Change by miss-islington :


--
pull_requests: +23640
pull_request: https://github.com/python/cpython/pull/24882

___
Python tracker 

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



[issue43285] ftplib should not use the host from the PASV response

2021-03-15 Thread miss-islington


Change by miss-islington :


--
pull_requests: +23641
pull_request: https://github.com/python/cpython/pull/24883

___
Python tracker 

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



[issue43285] ftplib should not use the host from the PASV response

2021-03-15 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

3.7 and 3.6 backport PRs created and assigned to release manager Ned for 
merging.

--
nosy: +ned.deily
resolution:  -> fixed
stage: patch review -> commit review
status: open -> closed

___
Python tracker 

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



[issue43503] [subinterpreters] PyObject statics exposed in the limited API break isolation.

2021-03-15 Thread Eric Snow


Eric Snow  added the comment:

Here are some solutions that I've considered:

1. immutable objects
   a. make the objects truly immutable/const
  * not trivial, if possible
   b. make the objects effectively immutable
  * (see GH-24828) use a really high refcount to make races irrelevant
2. per-interpreter objects
   a. replace them with macros that do a per-interpreter lookup
   b. replace them with simple placeholders and do a per-interpreter lookup 
internally
   c. replace them with PyObject placeholders and do a per-interpreter lookup 
internally

As far as I'm aware, only (1b) and (2c) are realistic and won't break the 
stable ABI (i.e. preserve layout).

(FWIW, I think that even with (1b) we would still have per-interpreter objects.)

-- Regarding (1a) --

See see GH-24828 for an example implementation.  This includes storing some 
state for the objects in PyInterpreterState and doing a lookup internally.

pros:
* relatively straightforward to implement
* overlaps with other interests (see bpo-40255)
* makes the objects shareable between interpreters (making them more efficient)

cons:
* we have to ensure the objects stay immutable (a tractable problem if the 
solution is constrained to only the limited API objects)

-- Regarding (2c) --

This involves adding an API to get the per-interpreter object for a given 
identity value (flag, global, etc.) and then mapping the limited API objects to 
the corresponding per-interpreter ones.

pros:
* avoids a one-off solution
* extensions can stop using the variables directly (in favor of the new lookup 
API)

cons:
* effectively couples the C-API to the design (as long as the objects are in 
the limited API)
* many touches all over the C-API
* any future changes/additions in the C-API must deal with the objects

--

___
Python tracker 

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



[issue43503] [subinterpreters] PyObject statics exposed in the limited API break isolation.

2021-03-15 Thread Eric Snow


Eric Snow  added the comment:

If the stable ABI weren't an issue then we would probably:

* deprecate using the objects directly
* do something like (2a) in the meantime

It may make sense to do that for "#ifndef Py_LIMITED_API", regardless of how we 
handle the limited API.

--

___
Python tracker 

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



[issue43478] Disallow Mock spec arguments from being Mocks

2021-03-15 Thread Chris Withers


Chris Withers  added the comment:

I agree that this should raise an exception.
Can the two failing tests in mock's own suite be easily fixed?

--

___
Python tracker 

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



[issue43503] [subinterpreters] PyObject statics exposed in the limited API break isolation.

2021-03-15 Thread Eric Snow


Change by Eric Snow :


--
nosy: +Mark.Shannon, nascheme, vstinner

___
Python tracker 

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



[issue43503] [subinterpreters] PyObject statics exposed in the limited API break isolation.

2021-03-15 Thread Eric Snow


Change by Eric Snow :


--
keywords: +patch
pull_requests: +23642
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/24828

___
Python tracker 

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



[issue43503] [subinterpreters] PyObject statics exposed in the limited API break isolation.

2021-03-15 Thread Eric Snow


Change by Eric Snow :


--
components: +Extension Modules, Interpreter Core, Subinterpreters

___
Python tracker 

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



[issue43478] Disallow Mock spec arguments from being Mocks

2021-03-15 Thread Matthew Suozzo


Matthew Suozzo  added the comment:

I've fixed a bunch of these in our internal repo so I'd be happy to add that to 
a patch implementing raising exceptions for these cases.

--

___
Python tracker 

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



[issue43285] ftplib should not use the host from the PASV response

2021-03-15 Thread Ned Deily


Ned Deily  added the comment:

@gps, What about ftplib doc changes and What's new entries for this change in 
behavior?

--

___
Python tracker 

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



[issue43478] Disallow Mock spec arguments from being Mocks

2021-03-15 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

The tests can be fixed. The change to raise exception can be merged to gather 
feedback during alpha/beta and see if there are any valid usecases.

--

___
Python tracker 

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



[issue11339] annotation for class being defined

2021-03-15 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Is this issue resolved with PEP 563 and the behavior becoming default in Python 
3.10? https://www.python.org/dev/peps/pep-0563/#forward-references

--
nosy: +xtreak

___
Python tracker 

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



[issue41567] multiprocessing.Pool from concurrent threads failure on 3.9.0rc1

2021-03-15 Thread doublex


doublex  added the comment:

Example code (fails):


import os, concurrent.futures

def parallel_callback( arg ):
return os.getpid()

def parallel( *args ):
def thread_callback( param ):
with concurrent.futures.ProcessPoolExecutor(max_workers=1) as executor:
future = executor.submit( parallel_callback, param )
pid = future.result()
print( 'pid:', pid )
return pid
with concurrent.futures.ThreadPoolExecutor(max_workers=len(args)) as 
executor:
future = executor.map( thread_callback, args )
results = list(future)
print( 'DONE' )

parallel( 1, 2, 3 )

--
nosy: +doublex

___
Python tracker 

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



[issue42128] Structural Pattern Matching (PEP 634)

2021-03-15 Thread Brandt Bucher


Brandt Bucher  added the comment:

@BTaskaya, do you have any interest in helping me iterate on new AST nodes?

--

___
Python tracker 

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



[issue11339] annotation for class being defined

2021-03-15 Thread Kamil Turek


Change by Kamil Turek :


--
nosy: +kamilturek

___
Python tracker 

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



[issue43503] [subinterpreters] PyObject statics exposed in the limited API break isolation.

2021-03-15 Thread Guido van Rossum


Guido van Rossum  added the comment:

I can never remember what "Py_LIMITED_API" stands for. If it's not defined, 
does that mean we have the *unlimited* API? Is that a superset or a subset of 
the limited API?

Regarding 1a *and* 1b, I think it would help to list the specific reasons 
exceptions and other types are not entirely immutable. Is it just 
__subclasses__ or is there other state (apart from the refcount) that's mutable 
and visible to the end user? (Or even if it's visible to C API users.)

--
nosy: +gvanrossum

___
Python tracker 

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



[issue43486] Python 3.9 installer not updating ARP table

2021-03-15 Thread Steve Dower


Steve Dower  added the comment:

Leaving the launcher behind is deliberate. Otherwise you might 
install/uninstall 3.10 alpha and lose the launcher completely.

I can't trivially reproduce the ARP issue, so we'll need some more information.

If possible, can you grab the install logs from %TEMP% and attach them here in 
a zip file?

Also, any information about any restrictive administrator policies or 
anti-virus tools running on your machine might be relevant.

--

___
Python tracker 

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



[issue43500] Add filtercase() into fnmatch

2021-03-15 Thread Kamil Turek


Change by Kamil Turek :


--
nosy: +kamilturek

___
Python tracker 

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



[issue42128] Structural Pattern Matching (PEP 634)

2021-03-15 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

> @BTaskaya, do you have any interest in helping me iterate on new AST nodes?

Sure!

--

___
Python tracker 

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



[issue17620] Python interactive console doesn't use sys.stdin for input

2021-03-15 Thread Eryk Sun


Change by Eryk Sun :


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

___
Python tracker 

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



[issue24829] Use interactive input even if stdout is redirected

2021-03-15 Thread Eryk Sun


Change by Eryk Sun :


--
dependencies: +Python interactive console doesn't use sys.stdin for input
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.6

___
Python tracker 

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



[issue43416] Add README files in Include/cpython and Include/internal

2021-03-15 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
keywords: +patch
nosy: +erlendaasland
nosy_count: 3.0 -> 4.0
pull_requests: +23643
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24884

___
Python tracker 

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



[issue35134] Add a new Include/cpython/ subdirectory for the "CPython API" with implementation details

2021-03-15 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
nosy: +erlendaasland
nosy_count: 7.0 -> 8.0
pull_requests: +23644
pull_request: https://github.com/python/cpython/pull/24884

___
Python tracker 

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



[issue29805] Support moving across filesystems in pathlib.Path, as shutil.move() does

2021-03-15 Thread Eryk Sun


Change by Eryk Sun :


--
components:  -Windows
title: Pathlib.replace cannot move file to a different drive on Windows if 
filename different -> Support moving across filesystems in pathlib.Path, as 
shutil.move() does
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.6

___
Python tracker 

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



[issue43492] Upgrade to SQLite 3.35.1 in macOS and Windows

2021-03-15 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

Bug-fix release 3.35.1 is out bco. https://sqlite.org/src/info/1c24a659e6d7f3a1

--
title: Upgrade to SQLite 3.35.0 in macOS and Windows -> Upgrade to SQLite 
3.35.1 in macOS and Windows

___
Python tracker 

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



[issue43285] ftplib should not use the host from the PASV response

2021-03-15 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

A What's New entry is a good idea.  I'll make one and add it to those backport 
PRs.  (reopened to remind me of that)

ftplib docs... I don't actually want to document the attribute that people can 
set for the old behavior beyond the notes in NEWS or What's New.  It is 
something I anticipate nobody in the world ever actually setting so I'd rather 
not imply that anyone even should by giving it more prominent doc space.

Other things that have fixed this repeated bug in their program that supports 
ftp over the years have not added an opt-out as far as I could tell in my quick 
searching.

--
status: closed -> open

___
Python tracker 

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



  1   2   >