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

2020-05-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

What do decimals have to datetime?

--
nosy: +serhiy.storchaka

___
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-05-28 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

The result of auto detection of computed gotos can be seen using the 
HAVE_COMPUTED_GOTOS macro, not the USE_... one. 

Computed gotos should work on macOS, and does on my machine.

--

___
Python tracker 

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



[issue40792] Make PyNumber_Index() always returning an exact int instance

2020-05-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 5f4b229df7812f1788287095eb6b138bb21876a4 by Serhiy Storchaka in 
branch 'master':
bpo-40792: Make the result of PyNumber_Index() always having exact type int. 
(GH-20443)
https://github.com/python/cpython/commit/5f4b229df7812f1788287095eb6b138bb21876a4


--

___
Python tracker 

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



[issue26202] The range() object is deepcopied as atomic

2020-05-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 5f4b229df7812f1788287095eb6b138bb21876a4 by Serhiy Storchaka in 
branch 'master':
bpo-40792: Make the result of PyNumber_Index() always having exact type int. 
(GH-20443)
https://github.com/python/cpython/commit/5f4b229df7812f1788287095eb6b138bb21876a4


--

___
Python tracker 

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



[issue40792] Make PyNumber_Index() always returning an exact int instance

2020-05-28 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
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



[issue40789] C-level destructor in PySide2 breaks gen_send_ex, which assumes it's safe to call Py_DECREF with a live exception

2020-05-28 Thread Nathaniel Smith


Nathaniel Smith  added the comment:

I don't think I understand what you mean by "reentrant"... we don't have any 
single piece of code that's calling back into itself. The question is about 
what the tp_dealloc contract is.

Digging into it more, it looks like the standard is for 
typeobject.c:slot_tp_finalize to save/restore exceptions when invoking 
Python-level __del__ methods, rather than it being the responsibility of the 
tp_dealloc or tp_finalizer caller. (And finding that code also answers my next 
question, which was going to be whether there are any other dance steps you 
have to do when re-entering CPython from a tp_dealloc!)

So I guess this is a PySide2 bug.

--

___
Python tracker 

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



[issue22250] unittest lowercase methods

2020-05-28 Thread Ram Rachum


Ram Rachum  added the comment:

I see it's been 6 years since the last comment here. I think it's important to 
revisit these kind of decisions once in a while. Maybe now the time is ripe for 
a change? We could do it backward compatibility with a long deprecation 
schedule.

Ezio: You said this was proposed and rejected. Can you link to the discussion? 
I couldn't find it.

--
nosy: +cool-RR

___
Python tracker 

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



[issue17576] PyNumber_Index() is not int-subclass friendly (or operator.index() docos lie)

2020-05-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The current status:

* Decimal and Fraction are no longer automatically converted to int when pass 
to functions implemented in C. PyLong_AsLong() etc no longer call __int__. (see 
issue36048 and issue37999)
* operator.index() and PyNumber_Index() always return an instance of exact type 
int. (see issue40792)
* int() and PyNumber_Long() always return an instance of exact type int. (see 
issue26984)
* __index__ is used as a fallback if __int__ is not defined. (see issue20092)

But:

* __index__ and __int__ are not called for int subclasses in operator.index() 
and int() (also in the C API PyNumber_Index(), PyNumber_Long(), 
PyLong_AsLong(), etc).
* Instances of int sublasses are accepted as result of __index__ and __int__ 
(but it is deprecated).
* The Python implementation of operator.index() differs from the C 
implementation in many ways. (see issue18712)

What I prefer as solutions of the remaining issues:

* It is good to not call __index__ and __int__ for int subclasses. __index__ 
and __int__ were   designed for converting non-integers to int. There are no 
good use cases for overriding __index__ and __int__ in int subclasses, and 
calling them is just a waste of time. We should just document this behavior.

* Undeprecate accepting __index__ and __int__ returning instances of int 
sublasses. There is no difference from the side of using int and index(), but 
it can simplify user implementations of __index__ and __int__.

* Either sync the pure Python implementation of operator.index() with the C 
implementation or get rid of Python implementation of the operator module at 
all.

--

___
Python tracker 

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



[issue37999] No longer use implicit convertion to int with loss

2020-05-28 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
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



[issue37999] No longer use implicit convertion to int with loss

2020-05-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I think it is all here. Thank you Mark for your review and for fixing outdated 
docs and comments.

--

___
Python tracker 

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



[issue22250] unittest lowercase methods

2020-05-28 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

See for example 
https://mail.python.org/archives/list/python-id...@python.org/thread/4HE2GFL27LGBSHGWOBDOOBPEULC52U4D/#RC3QWQUX6VP56K2WXSMRZ5IGNAUBXKRI

--
nosy: +remi.lapeyre

___
Python tracker 

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



[issue26202] The range() object is deepcopied as atomic

2020-05-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

This change has been reverted in issue40792. The range object attributes has 
now exact type int, so the original issue with deep copying is gone.

--

___
Python tracker 

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



[issue22250] unittest lowercase methods

2020-05-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

https://www.python.org/dev/peps/pep-0008/#a-foolish-consistency-is-the-hobgoblin-of-little-minds

--

___
Python tracker 

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



[issue38938] Possible performance improvement for heapq.merge()

2020-05-28 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

less_movement.py is my favorite so far. It still handles key and reverse,
but using instance attributes instead of the list indices I tried before.
It does this by only advancing the "key" and "leaf" attributes up toward
the root (where the key is just the value if key is None), while the value
is stored only in the leaf. Since the "value" attribute is no longer used
except for at the leaves, we can pack a leaf's value into its left slot
and reduce the number of slots.

This seems to run very well on pypy and it looks like it would be pretty
receptive to a c implementation, which I would be happy to work on.

--
title: Possible performance improvement for heaqq.merge() -> Possible 
performance improvement for heapq.merge()
versions: +Python 3.10 -Python 3.9
Added file: https://bugs.python.org/file49198/less_movement.py

___
Python tracker 

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



[issue17576] PyNumber_Index() is not int-subclass friendly (or operator.index() docos lie)

2020-05-28 Thread Mark Dickinson


Mark Dickinson  added the comment:

[Serhiy]

> * Undeprecate accepting __index__ and __int__ returning instances of int 
> sublasses. There is no difference from the side of using int and index(), but 
> it can simplify user implementations of __index__ and __int__.

I'm not sure about this. Thinking about the bigger picture, we have a similar 
deprecation in place for __float__ returning an instance of a float subclass. 
That one I'd like to keep (and probably make an error for 3.10).

A problem I've run into in Real Code (TM) is needing to convert something 
float-like to a float, using the same mechanisms that (for example) something 
like `math.sqrt` uses.

One option is to call "float", but that requires explicitly excluding str, 
bytes and bytearray, which feels ugly and not very future-proof.

So the code ends up calling __float__. But because __float__ can return an 
instance of a float subclass, it then still needs some way to convert the 
return value to an actual float. And that's surprisingly tricky.

So I really *do* want to see the ability of __float__ to return a non-float 
eventually removed.

Similarly for __int__, there's no easy Python-side way to mimic the effect of 
calling __int__, followed by converting to an exact int. We have to:

1. Do an explicit check for non-numbers (str, bytes, bytearray)
2. Call int

Or:

1. Call __int__
2. Convert an instance of a possible subclass of int to something of exact type 
int. I don't know how to do this cleanly in general in Python, and end up 
resorting to evil tricks like adding `0`.

Deprecating allowing __int__ to return a non-int helps here, because it lets me 
simply call __int__.

I care much more about the __float__ case than the __int__ case, because the 
"right way" to duck-type integers is to use __index__ rather than __int__, and 
for __index__ we have operator.index as a solution.

But it would seem odd to have the rule in place for __float__ but not for 
__int__ and __index__.


The other way to solve my problem would be to provide an operator module 
function (operator.as_float?) that does a duck-typed conversion of an arbitrary 
Python object to a float.

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue40789] C-level destructor in PySide2 breaks gen_send_ex, which assumes it's safe to call Py_DECREF with a live exception

2020-05-28 Thread Nathaniel Smith


Nathaniel Smith  added the comment:

Filed with PySide2: https://bugreports.qt.io/browse/PYSIDE-1313

--
resolution:  -> not a bug
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



[issue23897] Update Python 3 extension module porting guide

2020-05-28 Thread Petr Viktorin


Petr Viktorin  added the comment:

py3c has an open issue to check that Barry's notes on C extensions are 
included: https://github.com/encukou/py3c/issues/1
However, C extensions are only a small part of the wiki page.

--

___
Python tracker 

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



[issue33436] Add an interactive shell for Sqlite3

2020-05-28 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

I think this is a good idea. Proof-of-concept implementation added (invoke REPL 
with `python -m sqlite3`).

Possible improvements:
- Use sqlite3.complete_statement()
- Support Python syntax as well. For example:
>>> select * from t
>>> res = _
>>> print(res[0])

--
keywords: +patch
nosy: +erlendaasland
Added file: 
https://bugs.python.org/file49199/0001-Add-proof-of-concept-REPL.patch

___
Python tracker 

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



[issue40801] Expose PyFloat_ToDouble at Python level: operator.as_float?

2020-05-28 Thread Mark Dickinson


Change by Mark Dickinson :


--
title: Expose PyFloat_ToDouble at Python level: operator.to_float? -> Expose 
PyFloat_ToDouble at Python level: operator.as_float?

___
Python tracker 

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



[issue40801] Expose PyFloat_ToDouble at Python level: operator.to_float?

2020-05-28 Thread Mark Dickinson


New submission from Mark Dickinson :

Motivation
--

Various pieces of Python need to do a duck-typed conversion of an arbitrary 
float-like object to a float (or a C double) for computation. The math module 
is the most obvious example - most math-module functions that accept a float 
also accept float-like things, like np.float32 and Decimal - but it's not the 
only place that this is needed.

This conversion is easy at C level, being encapsulated in a single function 
call: PyFloat_AsDouble. (Plus a PyFloat_FromDouble if you want to go back to 
Python space, of course.)

But: it's surprisingly awkward to get an equivalent effect in pure Python code. 
Options are:

1. Do an explicit type check to exclude str, bytes and bytearray, and then call 
the float constructor. But the extra type check is ugly and potentially not 
future-proof.

2. Call type(obj).__float__(obj). But this has several problems: __float__ can 
return an instance of a float subclass rather than a strict float, and then 
it's hard to convert to an actual float. And in more recent versions of Python, 
this no longer matches PyFloat_AsDouble because it doesn't account for objects 
that provide __index__ but not __float__. And calling dunder methods directly 
should rarely be the Right Way To Do It.

3. Use the implicit ability of the math module to do this, for example using 
math.copysign(obj, obj). This works! But it's not a clear expression of the 
intent.

This has bitten me in Real Code (TM), where I've needed a way to convert an 
arbitrary float-like thing to a float, ideally following the same rules that 
Python uses. And also ideally in such a way that my own code doesn't have to 
change if Python updates its rules, as for example it did recently to allow 
things with an __index__ to be considered float-like.


Proposal


Add a new operator function "operator.as_float" which matches Python's 
duck-typed acceptance of float-like things, in the same way that the existing 
operator.index matches Python's implicit acceptance of int-like things in 
various APIs that expect integers.

Internally, "operator.as_float" would simply call PyFloat_AsDouble followed by 
PyFloat_FromDouble (possibly with a fast path to pass objects of exact type 
float through directly).



Related: #17576.

--
messages: 370181
nosy: mark.dickinson, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Expose PyFloat_ToDouble at Python level: operator.to_float?
type: enhancement
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



[issue40802] AbstractEventLoop.shutdown_default_executor breaks backwards compatibility

2020-05-28 Thread Petr Viktorin


New submission from Petr Viktorin :

In bpo-34037, AbstractEventLoop gained a new abstract method, 
shutdown_default_executor:
https://docs.python.org/dev/library/asyncio-eventloop.html#asyncio.loop.shutdown_default_executor

All AbstractEventLoop subclasses need to define this method, otherwise they are 
not compatible with Python 3.9's asyncio. It seems that the anyio and uvloop 
projects are affected: https://github.com/agronholm/anyio/issues/110

This is mentioned in What's New: 
https://docs.python.org/dev/whatsnew/3.9.html#changes-in-the-python-api

I'd like to make extra sure asyncio experts know about this backwards 
incompatibility.
Since asyncio is no longer provisional, should it break backwards compatibility 
with just a What's New entry?

--
components: asyncio
messages: 370182
nosy: asvetlov, petr.viktorin, yselivanov
priority: normal
severity: normal
status: open
title: AbstractEventLoop.shutdown_default_executor breaks backwards 
compatibility
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



[issue36859] sqlite3 dml statement detection does not account for CTEs

2020-05-28 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
nosy: +erlendaasland

___
Python tracker 

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



[issue40803] Unable to execute python.exe from zip in wine

2020-05-28 Thread Robin


New submission from Robin :

I've downloaded python38.zip(and python32.zip).  It doesn't run because it's 
using an API `PathCchCanonicalizeEx()` that's not provided in wine.

```
Z:\home\rmills\temp\python-3>wine: Call from 0x7b43cfbc to unimplemented 
function api-ms-win-core-path-l1-1-0.dll.PathCchCanonicalizeEx, aborting
wine: Unimplemented function 
api-ms-win-core-path-l1-1-0.dll.PathCchCanonicalizeEx called at address 
0x7bc50023:0x7b43cfbc (thread 0034), starting debugger...
Unhandled exception: unimplemented function 
api-ms-win-core-path-l1-1-0.dll.PathCchCanonicalizeEx called in 32-bit code 
(0x7b43cfbc).
```

--
components: Windows
messages: 370183
nosy: clanmills, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Unable to execute python.exe from zip in wine
type: crash
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



[issue40804] Bug report in python3.6.8 using argparse module

2020-05-28 Thread amansi26


New submission from amansi26 :

I am using 3.6.8 version of python.
I am seeing an error as AttributeError: 'Namespace' object has no attribute 
'func' while using argparse . The code is working fine with python2.7 argparser.

I see a similar bug [4] reported at python 3.3 and  python3.4. The workaround 
mentioned works fine for a single level command.
 
Scenarios:
- If there is one command and various subcommands, like [1].The solution works 
fine.
- But suppose I have a command with mutiple level of subcommands like [2]. In 
this case if I give [3] as a command the ArgumentParser.prog() takes just the 
first command as input in this 
  case (open-stack). Hence the parser.print_usage prints [1].
 
 [1] [2] [3]   https://bpa.st/PUPA
 
[4]  https://bugs.python.org/issue16308

--
messages: 370184
nosy: amansi26
priority: normal
severity: normal
status: open
title: Bug report in python3.6.8 using argparse module
type: behavior
versions: Python 3.6

___
Python tracker 

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



[issue40803] Unable to execute python.exe from zip in wine

2020-05-28 Thread Robin


Robin  added the comment:

I've reported this to the wine team:
https://bugs.winehq.org/show_bug.cgi?id=49271

--

___
Python tracker 

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



[issue40803] Unable to execute python.exe from zip in wine

2020-05-28 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

Hi Robin, it looks like you are trying to run Python for Windows on Linux using 
Wine but that it's not supported by Wine.

Why would this be a bug in the CPython interpreter thought? It looks like there 
is nothing we can do here to fix this right?

--
nosy: +remi.lapeyre

___
Python tracker 

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



[issue9338] argparse optionals with nargs='?', '*' or '+' can't be followed by positionals

2020-05-28 Thread Dávid Horváth

Change by Dávid Horváth :


--
nosy: +Dávid Horváth

___
Python tracker 

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



[issue40804] Bug report in python3.6.8 using argparse module

2020-05-28 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

Hi amansi26, thanks for reporting this issue.

Without an example program that reproduces it, we won't be able to diagnose and 
fix it thought. Can you post one?

--
nosy: +remi.lapeyre

___
Python tracker 

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



[issue38605] [typing] PEP 563: Postponed evaluation of annotations: enable it by default in Python 3.10

2020-05-28 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

>From now on, should typing.get_type_hints automatically resolve arguments too? 
>An example would be this;

import typing
T = typing.TypeVar("T")
class Loop(typing.Generic[T]):
subloop: typing.Final["Loop[int]"]
print(typing.get_type_hints(Loop))
>>> {'subloop': typing.Final[__main__.Loop[int]]}
If we run the same code under future annotations
>>> {'subloop': typing.Final[ForwardRef('Loop[int]')]}

--

___
Python tracker 

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



[issue40801] Expose PyFloat_ToDouble at Python level: operator.as_float?

2020-05-28 Thread Mark Dickinson


Change by Mark Dickinson :


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

___
Python tracker 

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



[issue40801] Expose PyFloat_ToDouble at Python level: operator.as_float?

2020-05-28 Thread Mark Dickinson


Mark Dickinson  added the comment:

Proof of concept in GH-20481

--

___
Python tracker 

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



[issue17576] PyNumber_Index() is not int-subclass friendly (or operator.index() docos lie)

2020-05-28 Thread Mark Dickinson


Mark Dickinson  added the comment:

> The other way to solve my problem would be to provide an operator module 
> function (operator.as_float?) that does a duck-typed conversion of an 
> arbitrary Python object to a float.

This does feel like the *right* solution to me. See #40801 and the linked PR. 
If we can do something like this, I'd be happy to drop the expectation that 
__float__ return something of exact type float, and similarly for __index__.

--

___
Python tracker 

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



[issue40275] test.support has way too many imports

2020-05-28 Thread hai shi


Change by hai shi :


--
pull_requests: +19731
pull_request: https://github.com/python/cpython/pull/20482

___
Python tracker 

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



[issue40803] Unable to execute python.exe from zip in wine

2020-05-28 Thread Robin


Robin  added the comment:

Thanks for such a rapid response.  Much appreciated.

I think it's a bug in wine, so I've also reported it to them.  And you both 
know that you both have it on your radar!

I believe the Win32/API PathCchCanonicalizeEx() is quite new, and that's why 
it's not in wine-core-magic.  However, python could consider reverting to your 
earlier code.  And another possibility is to test that PathCchCanonicalizeEx != 
NULL before calling it.  If it is NULL, then use the "old" code.

https://docs.microsoft.com/en-us/windows/win32/api/pathcch/nf-pathcch-pathcchcanonicalizeex

Let's see what the wine men (and ladies) say!

--

___
Python tracker 

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



[issue40803] Unable to execute python.exe from zip in wine

2020-05-28 Thread Robin


Robin  added the comment:

Good News.  The wine people say "Fixed in wine 4.0".  So, a happy result.

https://bugs.winehq.org/show_bug.cgi?id=49271

We can close this.

--

___
Python tracker 

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



[issue40803] Unable to execute python.exe from zip in wine

2020-05-28 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

Thanks, I think you can close it by setting the Status field to "closed".

--

___
Python tracker 

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



[issue40724] Support buffer protocol with type specs

2020-05-28 Thread Petr Viktorin


Petr Viktorin  added the comment:

Yes, it should be possible to wrap them in #if so they aren't part of the 
stable ABI.

--

___
Python tracker 

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



[issue40804] Bug report in python3.6.8 using argparse module

2020-05-28 Thread Florian Dahlitz


Change by Florian Dahlitz :


--
nosy: +DahlitzFlorian

___
Python tracker 

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



[issue40803] Unable to execute python.exe from zip in wine

2020-05-28 Thread Robin


Change by Robin :


--
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



[issue40798] The deprecated-removed Sphinx extension need to change the error message based on the Python version

2020-05-28 Thread Florian Dahlitz


Change by Florian Dahlitz :


--
nosy: +DahlitzFlorian

___
Python tracker 

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



[issue40791] hmac.compare_digest could try harder to be constant-time.

2020-05-28 Thread miss-islington


miss-islington  added the comment:


New changeset 8183e11d87388e4e44e3242c42085b87a878f781 by Christian Heimes in 
branch '3.9':
[3.9] bpo-40791: Use CRYPTO_memcmp() for compare_digest (GH-20456) (GH-20461)
https://github.com/python/cpython/commit/8183e11d87388e4e44e3242c42085b87a878f781


--
nosy: +miss-islington

___
Python tracker 

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



[issue40770] RFE: Run linkchecker on documentation on the CI

2020-05-28 Thread Miro Hrončok

Miro Hrončok  added the comment:

Note: I would gladly contribute this check, but I have no idea where should I 
do that.

--

___
Python tracker 

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



[issue40805] Can no longer patch flask.g

2020-05-28 Thread Rob Taft


New submission from Rob Taft :

Whenever I try to patch flask.g, it appears to do nothing.  This happened when 
I upgraded mock from 3.x to 4.x.  I reported it on the mock github page 
https://github.com/testing-cabal/mock/issues/490 and was asked to report it 
here.  The folllowing code run with pytest works fine in mock 3.0.5, but fails 
to patch in 4.0.0 and up.

from mock import patch

import flask


def some_function():
flask.g.somevariable = True
return flask.g.somevariable


@patch('flask.g')
def test_some_function(mock_flask_global):
assert some_function()

--
components: Tests
messages: 370197
nosy: Rob Taft
priority: normal
severity: normal
status: open
title: Can no longer patch flask.g
type: behavior
versions: Python 3.6, Python 3.8

___
Python tracker 

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



[issue40654] shutil.copyfile mutates symlink for absolute path

2020-05-28 Thread Eryk Sun


Eryk Sun  added the comment:

Modifying readlink() to return an str subclass that preserves the print name is 
an interesting idea, but not on topic here. 

For the cases where os.readlink is used to manually follow links (*), such as 
ntpath.realpath, using the substitute name is the most reliable option since 
that's the actual path that the system uses. But this issue is about the use of 
os.readlink in order to copy symlinks in shutil.move, shutil.copyfile, and 
shutil.copytree. I'd still be happy to assist with the development of an 
os.copylink function that copies the reparse point exactly via low-level 
FSCTL_GET_REPARSE_POINT and FSCTL_SET_REPARSE_POINT. It has to use the 
low-level API because it turns out that CopyFileExW and CreateDirectoryExW fail 
if they can't enable the symlink privilege, which is not actually required if 
the system is in developer mode. For shutil, it would be used as 
shutil._copylink. In POSIX, shutil._copylink would continue to just use 
readlink and symlink.

---

(*) off-topic note

Manually following remote mountpoints is never correct. They are intended to be 
evaluated by the remote system using its local devices. 

Manually following remote-to-local (R2L) symlinks is almost always incorrect 
and should be disallowed by local symlink evaluation policy Check `fsutil 
behavior query symlinkevaluation`. A remote SMB server opens a path in a way 
that has the remote I/O manager stop parsing at the first symlink, which may be 
a directory symlink in the path (it's not necessarily the final component, 
unlike FILE_FLAG_OPEN_REPARSE_POINT). The server completes the request with a 
message to the client redirector that contains the parsed path of the symlink, 
the remaining unparsed path, and the target of the symlink. The local SMB 
redirector decides whether to allow reparsing based on its L2L, L2R, R2L, and 
R2R symlink policies. This reparse is implemented locally, with local devices. 
It is unlikely that a non-relative symlink that targets local device paths 
(e.g. "//server/share/symlink" -> "E:/work/file") was intended to be evaluated 
on another machine, so R2L should almost always be disallowed. Bypassing 
 the system's R2L policy when manually following a symlink is always wrong.

--

___
Python tracker 

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



[issue40798] The deprecated-removed Sphinx extension need to change the error message based on the Python version

2020-05-28 Thread Florian Dahlitz


Florian Dahlitz  added the comment:

I would like to submit a PR for it if possible.

--

___
Python tracker 

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



[issue40798] The deprecated-removed Sphinx extension need to change the error message based on the Python version

2020-05-28 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

Hi Florian, please have a go and open one on GitHub so it can be reviewed.

--

___
Python tracker 

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



[issue40805] Can no longer patch flask.g

2020-05-28 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue40806] itertools.product not lazy

2020-05-28 Thread Ramil Nugmanov


New submission from Ramil Nugmanov :

def x(y):
while True:
yield y

p = product(x(1), x(2))

next(p)  # this string will never be reached.

--
components: Library (Lib)
messages: 370201
nosy: nougmanoff
priority: normal
severity: normal
status: open
title: itertools.product not lazy
type: behavior
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



[issue40770] RFE: Run linkchecker on documentation on the CI

2020-05-28 Thread Ama Aje My Fren

Ama Aje My Fren  added the comment:

On Thu, May 28, 2020 at 3:13 PM Miro Hrončok  wrote:

>
> Note: I would gladly contribute this check, but I have no idea where should I 
> do that.
>

I don't know either. I suspect it will have to be with one of the
CI/CD providers that cpython uses.

I _think_ it uses three:
a. Travis  cpython/.travis.yml
b. Github Actions .github/workflows/doc.yml
c. Azures Pipelines .azure-pipelines/docs-steps.yml

Beyond that no idea. I fear I am also blind here. Still google is my friend.

--
nosy: +amaajemyfren

___
Python tracker 

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



[issue40806] itertools.product not lazy

2020-05-28 Thread Rémi Lapeyre

Change by Rémi Lapeyre :


--
nosy: +rhettinger, tim.peters

___
Python tracker 

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



[issue40806] itertools.product not lazy

2020-05-28 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

Hi Ramil, itertools.product() expect its argument to be finite iterables, it 
needs to keep all their elements in memory anyway at it "cycles around" to 
produce all possible pairs.

Basically, product(x(1), x(2)) is equivalent to product(tuple(x(1)), 
tuple(x(2))).


I see that the documentation does not mention that the arguments must be 
finite, could you open a PR to improve it?

--
nosy: +remi.lapeyre

___
Python tracker 

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



[issue40798] The deprecated-removed Sphinx extension need to change the error message based on the Python version

2020-05-28 Thread Florian Dahlitz


Change by Florian Dahlitz :


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

___
Python tracker 

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



[issue38488] Update bundled pip to 19.3

2020-05-28 Thread STINNER Victor


New submission from STINNER Victor :

> Various buildbots which run the tests with an installed python, fail with: 
> (...)

It's the "chmod" step which fails. I guess that only "Install" buildbot workers 
are affected. I failed to reproduce the issue with commands:
---
./configure --prefix $PWD/target --with-pydebug
make && make install
chmod -R -w target/
---

I get these permissions:
---
$ ls -l target/lib/python3.10/site-packages/setuptools-46.1.3.dist-info/RECORD
-r--r--r--. 1 vstinner vstinner 14560 28 mai   03:40 
target/lib/python3.10/site-packages/setuptools-46.1.3.dist-info/RECORD
---

--
nosy: +vstinner

___
Python tracker 

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



[issue38488] Update bundled pip to 19.3

2020-05-28 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue30064] BaseSelectorEventLoop.sock_{recv, sendall}() don't remove their callbacks when canceled

2020-05-28 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +19734
pull_request: https://github.com/python/cpython/pull/20485

___
Python tracker 

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



[issue30064] BaseSelectorEventLoop.sock_{recv, sendall}() don't remove their callbacks when canceled

2020-05-28 Thread STINNER Victor


STINNER Victor  added the comment:

I created https://github.com/python/cpython/pull/20485 to skip the unstable 
tests until someone fix them. IMO it's better to skip the test than reverting 
the fix, since the fix does fix a race condition.

The test is still failing on buildbots which makes analysis of buildbot 
failures more difficult. For example, a SQLite change got 3 different 4 
different bugs on buildbots:
https://github.com/python/cpython/pull/20448#issuecomment-635350054

See the "revert on fail" policy for buildbots:
https://pythondev.readthedocs.io/ci.html#revert-on-fail


> I'm also a bit skeptical about relying on `time.sleep(0.01)` at the end of 
> the loop in `_basetest_sock_recv_racing()`

Yeah, please avoid sleep as a synchronization primitive:
https://pythondev.readthedocs.io/unstable_tests.html#don-t-use-sleep-as-synchronization

--

___
Python tracker 

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



[issue8087] Unupdated source file in traceback

2020-05-28 Thread Robert Reynolds

Robert Reynolds  added the comment:

I second [what was said by Aigars 
Mahinovs](https://bugs.python.org/issue8087#msg300990) about long-running 
processes giving confusing tracebacks that make debugging very difficult. I 
have a Natural Language Processing pipeline extracting features from a large 
corpus of texts, and that process can take days to complete. If the underlying 
modules have since been edited, then when an Exception occurs – including a 
KeyboardInterrupt – then the traceback shows the wrong lines. The functions 
listed at the end of the line are correct, which is the only reason I was able 
to easily detect the source of my confusion; the line number cited was no 
longer inside of the listed function!

I propose one more simple thing to track that would be helpful in my situation: 
how many lines were in the file at call time vs now. It would be (potentially) 
helpful to have a warning point out that the cited module is now 17 lines 
longer than it was when it was imported. That way I can make more intelligent 
guesses about what line was actually the culprit. Obviously there could have 
been additions and deletions, which muddies the water, but this would at least 
be a starting point.

--

___
Python tracker 

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



[issue38488] Update bundled pip to 19.3

2020-05-28 Thread STINNER Victor


STINNER Victor  added the comment:

This commit introduced another regression, bpo-40808: test_venv fails with 
HOME=/ on AMD64 FreeBSD Non-Debug 3.x.

--

___
Python tracker 

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



[issue38488] Update bundled pip to 19.3

2020-05-28 Thread STINNER Victor


STINNER Victor  added the comment:

commit feb0846c3a28b05b4cfbc6ab34c764957f3eff55
Author: Xavier Fernandez 
Date:   Wed May 27 12:49:34 2020 +0200

Upgrade bundled versions of pip & setuptools (#16782)

--

___
Python tracker 

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



[issue40807] CODEOP: Show warnings once during _maybe_compile

2020-05-28 Thread Cheryl Sabella


Change by Cheryl Sabella :


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

___
Python tracker 

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



[issue40808] test_venv fails with HOME=/ on AMD64 FreeBSD Non-Debug 3.x

2020-05-28 Thread STINNER Victor


New submission from STINNER Victor :

test_venv fails on AMD64 FreeBSD Non-Debug 3.x since this build:
https://buildbot.python.org/all/#/builders/214/builds/808

This build has 3 changes. IMHO the regression comes from the commit 
feb0846c3a28b05b4cfbc6ab34c764957f3eff55: "Upgrade bundled versions of pip & 
setuptools (#16782)" (bpo-38488).

==
FAIL: test_with_pip (test.test_venv.EnsurePipTest)
--
Traceback (most recent call last):
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-9e36.nondebug/build/Lib/test/test_venv.py",
 line 535, in test_with_pip
self.do_test_with_pip(False)
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-9e36.nondebug/build/Lib/test/test_venv.py",
 line 518, in do_test_with_pip
self.assertEqual(err.rstrip(), "")
AssertionError: "WARNING: The directory '/.cache/pip' or [206 chars]lag." != ''
- WARNING: The directory '/.cache/pip' or its parent directory is not owned or 
is not writable by the current user. The cache has been disabled. Check the 
permissions and owner of that directory. If executing pip with sudo, you may 
want sudo's -H flag.
+ 



test.pythoninfo says:

os.environ[HOME]: /
pwd.getpwuid(1002): pwd.struct_passwd(pw_name='buildbot', pw_passwd='*', 
pw_uid=1002, pw_gid=1002, pw_gecos='FreeBSD BuildBot', pw_dir='/home/buildbot', 
pw_shell='/bin/sh')
os.getuid: 1002
os.login: koobs
os.getgid: 1002
os.getgrouplist: 1002
os.getgroups: 1002

--
components: Tests
messages: 370209
nosy: vstinner
priority: normal
severity: normal
status: open
title: test_venv fails with HOME=/ on AMD64 FreeBSD Non-Debug 3.x
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



[issue40807] CODEOP: Show warnings once during _maybe_compile

2020-05-28 Thread Cheryl Sabella


New submission from Cheryl Sabella :

When calling `codeop._maybe_compile`, `compile` is run three times.  If the 
code being compiled causes a warning message, the warning is generated each 
time that `compile` is called, thus (possibly) showing the message three times.


See msg370163 and that issue for context.

--
components: Library (Lib)
messages: 370208
nosy: cheryl.sabella
priority: normal
severity: normal
status: open
title: CODEOP: Show warnings once during _maybe_compile
type: enhancement
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



[issue37824] IDLE: Handle Shell input warnings properly.

2020-05-28 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

Thanks, Terry.  I created issue40807 for the codeop warnings.

--

___
Python tracker 

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



[issue8087] Unupdated source file in traceback

2020-05-28 Thread Robert Reynolds


Robert Reynolds  added the comment:

A pure python demonstration of the problem looks like this (`__file__` stores 
the path to the executed module):

```python
with open(__file__) as f:
src = f.read()
with open(__file__, 'w') as f:
f.write('\n\n\n\n\n# Whoops! Wrong line!\n')
f.write(src)
raise NotImplementedError('The prepended lines have confused you.')
```

--
nosy: +Robert Reynolds

___
Python tracker 

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



[issue38488] Update bundled pip to 19.3

2020-05-28 Thread STINNER Victor


STINNER Victor  added the comment:

The change broke multiple buildbots. Since nobody is available to investigate 
the two regressions (install buildbots and test_venv), I reverted the change 
following this policy:
https://pythondev.readthedocs.io/ci.html#revert-on-fail

Buildbot failures were reported directly the on PR, see:
https://github.com/python/cpython/pull/16782#issuecomment-634640005

The revert is an opportunity to have more time to investigate the issue and 
write a proper fix, rather than working on urgency.

commit 4fd4963ccce5c12f742303dab6e43818b1133c7e (HEAD -> master, 
upstream/master)
Author: Victor Stinner 
Date:   Thu May 28 15:57:49 2020 +0200

Revert "Upgrade bundled versions of pip & setuptools (#16782)" (GH-20484)

This reverts commit feb0846c3a28b05b4cfbc6ab34c764957f3eff55.

--

___
Python tracker 

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



[issue38605] [typing] PEP 563: Postponed evaluation of annotations: enable it by default in Python 3.10

2020-05-28 Thread Guido van Rossum


Guido van Rossum  added the comment:

I think in general it is more insightful to discuss the behavior of 
get_type_hints() given specific things in annotations.

We generally don't write forward refs inside forward refs, like 
"SomeClass['int']". So maybe that code was wrong? Where did you find it?

--

___
Python tracker 

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



[issue38488] Update bundled pip to 19.3

2020-05-28 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



[issue30064] BaseSelectorEventLoop.sock_{recv, sendall}() don't remove their callbacks when canceled

2020-05-28 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 84ee7e1573d166fe7a9be676813e12523b62ab24 by Victor Stinner in 
branch 'master':
bpo-30064: Fix unstable asyncio "racing" socket tests (GH-20485)
https://github.com/python/cpython/commit/84ee7e1573d166fe7a9be676813e12523b62ab24


--

___
Python tracker 

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



[issue30064] BaseSelectorEventLoop.sock_{recv, sendall}() don't remove their callbacks when canceled

2020-05-28 Thread miss-islington


Change by miss-islington :


--
pull_requests: +19736
pull_request: https://github.com/python/cpython/pull/20487

___
Python tracker 

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



[issue40275] test.support has way too many imports

2020-05-28 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +19737
pull_request: https://github.com/python/cpython/pull/20488

___
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-05-28 Thread STINNER Victor


Change by STINNER Victor :


--
title: Create Lib/_pydecimal.py file to optimize "import datetime" when 
_decimal is available -> Create Lib/_pydatetime.py file to optimize "import 
datetime" when _datetime is available

___
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-05-28 Thread STINNER Victor


STINNER Victor  added the comment:

> What do decimals have to datetime?

Oops. Sorry, I was confused between "datetime" and "decimal" when I created 
this issue. I fixed the issue title.

My idea is to mimick Lib/decimal.py design for Lib/datetime.py.

--

___
Python tracker 

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



[issue40275] test.support has way too many imports

2020-05-28 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 24bddc1b3b58f6899b2d412e51b37f68536e4fe2 by Hai Shi in branch 
'master':
 bpo-40275: Remove test.support.TESTFN_ENCODING (GH-20482)
https://github.com/python/cpython/commit/24bddc1b3b58f6899b2d412e51b37f68536e4fe2


--

___
Python tracker 

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



[issue30064] BaseSelectorEventLoop.sock_{recv, sendall}() don't remove their callbacks when canceled

2020-05-28 Thread miss-islington


miss-islington  added the comment:


New changeset 1d82f003678816ff8dd822452ec91669844d2d09 by Miss Islington (bot) 
in branch '3.9':
bpo-30064: Fix unstable asyncio "racing" socket tests (GH-20485)
https://github.com/python/cpython/commit/1d82f003678816ff8dd822452ec91669844d2d09


--

___
Python tracker 

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



[issue30064] BaseSelectorEventLoop.sock_{recv, sendall}() don't remove their callbacks when canceled

2020-05-28 Thread STINNER Victor


STINNER Victor  added the comment:

> bpo-30064: Fix unstable asyncio "racing" socket tests (GH-20485)

Sorry. You should read "Skip" tests, not "Fix" tests :-p

--

___
Python tracker 

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



[issue38605] [typing] PEP 563: Postponed evaluation of annotations: enable it by default in Python 3.10

2020-05-28 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

An example would be this 
https://github.com/python/cpython/blob/24bddc1b3b58f6899b2d412e51b37f68536e4fe2/Lib/test/test_typing.py#L2744-L2745.
 Either I can change tests in order to reflect now everything is a forward ref 
by default
class Loop:
attr: Final['Loop']
to
class Loop:
attr: Final[Loop]
or resolve everything on get_type_hints.

--

___
Python tracker 

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



[issue37878] Sub-Interpreters : Document PyThreadState_DeleteCurrent()

2020-05-28 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +19738
pull_request: https://github.com/python/cpython/pull/20489

___
Python tracker 

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



[issue40275] test.support has way too many imports

2020-05-28 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 753643205a28531fd43ef36b40b86282ae6956a7 by Victor Stinner in 
branch 'master':
bpo-40275: Fix test.support.threading_helper (GH-20488)
https://github.com/python/cpython/commit/753643205a28531fd43ef36b40b86282ae6956a7


--

___
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-05-28 Thread Paul Ganssle

Paul Ganssle  added the comment:

I basically agree with this — this is one of the reasons I structured the 
zoneinfo module the way I did rather than mimicking the pattern in datetime.

I believe that there are other modules that have similar situations like heapq, 
but datetime is probably the worst offender.

I am inclined to say that we should restructure datetime into a folder, 
containing __init__.py, _datetime.py and possibly _strptime.py (which I think 
is also only used in datetime), but I think that sort of restructuring is way 
more sensitive to weird import bugs than this one.

As it is now, I would be shocked if this didn't break *someone*, because people 
are always relying on weird implementation details (knowingly or unknowingly), 
but I think it's worth doing; it's good to tackle it this early in the cycle.

@vstinner What do you think about restructuring into a folder-based submodule 
rather than _pydatetime.py? It's way more likely to break someone, but I think 
it might be the better way to organize the code, and I don't want to have to go 
through *two* refactors of this sort.

--

___
Python tracker 

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



[issue38605] [typing] PEP 563: Postponed evaluation of annotations: enable it by default in Python 3.10

2020-05-28 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



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

2020-05-28 Thread miss-islington


Change by miss-islington :


--
pull_requests: +19739
pull_request: https://github.com/python/cpython/pull/20490

___
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-05-28 Thread STINNER Victor


STINNER Victor  added the comment:

> I believe that there are other modules that have similar situations like 
> heapq, but datetime is probably the worst offender.

heapq seems to be a little bit different. _heapq is not a drop-in replacement 
of heapq.py. For example, nlargest() seems to only be implemented in pure 
Python.


> I am inclined to say that we should restructure datetime into a folder, 
> containing __init__.py, _datetime.py and possibly _strptime.py (which I think 
> is also only used in datetime), but I think that sort of restructuring is way 
> more sensitive to weird import bugs than this one.

I have no idea what are the side effects of converting datetime.py file into a 
package.

A single file _pydatetime.py seems more convenient to me. I'm aware of 
_strptime.py but I don't see it as a datetime submodule and I don't see the 
value of moving it as a datetime submodule.

I'm fine with _datetime accessing _strptime module. It sounds more complex to 
me if _datetime would be imported by datetime which contains 
datetime._strptime. I see a higher risk of subtle import issues, since datetime 
has two implementations (C and Python). But it may be wrong :-)

Also, all other stdlib modules which have a C implementation are designed with 
files, not folders: io.py (_io and _pyio) and decimal.py (_decimal and 
_pydecimal) are good examples.

I mostly case about reducing the number of indirect imports and import 
performance. I don't have a strong opinion about file vs folder.


> As it is now, I would be shocked if this didn't break *someone*, because 
> people are always relying on weird implementation details (knowingly or 
> unknowingly), but I think it's worth doing; it's good to tackle it this early 
> in the cycle.

I'm fine with breaking applications relying on implementation details. Also, we 
can adjust the code to fix such corner cases later if it's needed, possible and 
justified :-)

--

___
Python tracker 

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



[issue38488] Update bundled pip to 19.3

2020-05-28 Thread Xavier Fernandez


Change by Xavier Fernandez :


--
pull_requests: +19740
pull_request: https://github.com/python/cpython/pull/20491

___
Python tracker 

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



[issue40700] Make WSGIRequestHandler easier to be customized by the user

2020-05-28 Thread Manjusaka


Manjusaka  added the comment:

ping~

--

___
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-05-28 Thread miss-islington


miss-islington  added the comment:


New changeset bcbe5c59dde5fcb9ad21991c2afd91837b14bbd5 by Miss Islington (bot) 
in branch '3.9':
bpo-40217:  Ensure Py_VISIT(Py_TYPE(self)) is always called for PyType_FromSpec 
types (reverts GH-19414) (GH-20264)
https://github.com/python/cpython/commit/bcbe5c59dde5fcb9ad21991c2afd91837b14bbd5


--

___
Python tracker 

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



[issue40770] RFE: Run linkchecker on documentation on the CI

2020-05-28 Thread Andy Lester


Andy Lester  added the comment:

Some high-level questions to consider:

* Is it run only when a build of the docs is started?  Or should it be done 
regularly (daily/weekly?) to keep an eye on links so that it's not a surprise 
when build time comes along?

* Does a broken link stop the build, or is it just advisory?

* Who sees the results?  Are they emailed to someone?  A mailing list?  Posted 
somewhere publicly?

* Is someone assigned responsibility for acting on the failures?

* What counts as a failure?  Is a 301 redirect OK?  It seems that a 301 might 
be OK to pass, but someone should know about it to update to the new URL.

I am not familiar with the current documentation build process, so forgive me 
if these are already answered somehow.  I'm not looking for answers myself, but 
providing suggestions.

--

___
Python tracker 

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



[issue25920] PyOS_AfterFork should reset socketmodule's lock

2020-05-28 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 0de437de6210c2b32b09d6c47a805b23d023bd59 by Victor Stinner in 
branch 'master':
bpo-25920: Remove socket.getaddrinfo() lock on macOS (GH-20177)
https://github.com/python/cpython/commit/0de437de6210c2b32b09d6c47a805b23d023bd59


--

___
Python tracker 

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



[issue40806] itertools.product not lazy

2020-05-28 Thread Ramil Nugmanov


Change by Ramil Nugmanov :


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

___
Python tracker 

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



[issue40755] Add missing multiset predicates to collections.Counter

2020-05-28 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 60398512c86c5535edd817c99ccb50453b3b0471 by Raymond Hettinger in 
branch 'master':
bpo-40755: Add missing multiset operations to Counter() (GH-20339)
https://github.com/python/cpython/commit/60398512c86c5535edd817c99ccb50453b3b0471


--

___
Python tracker 

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



[issue25920] PyOS_AfterFork should reset socketmodule's lock

2020-05-28 Thread STINNER Victor


STINNER Victor  added the comment:

If I understood correctly, Python 3.8 and 3.9 binaries provided by python.org 
is *not* impacted by this issue.

Only Python binaries built manually with explicit support for macOS 10.4 
("MAC_OS_X_VERSION_MIN_REQUIRED") were impacted.

Python 3.9 and older are not fixed (keep the lock). The workaround is to 
require macOS 10.5 or newer. macOS 10.4 was released in 2004, it's maybe time 
to stop support it :-)

Python 3.7 (and newer) requires macOS 10.6 or newer (again, I'm talking about 
binaries provided by python.org).


> bpo-25920: Remove socket.getaddrinfo() lock on macOS (GH-20177)

I chose to leave the lock for gethostbyname(). Ronald wrote that this lock is 
no longer needed:
"As an aside (not to be addressed in the PR): Apparently gethostbyname() and 
related functions are thread-safe on macOS. This is according to the manpage on 
macOS 10.15. I haven't checked in which version that changed. This allows 
avoiding the use of the gethostbyname lock as well."
https://github.com/python/cpython/pull/20177#pullrequestreview-418909595

Please open a separated issue for this lock.

--
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



[issue40755] Add missing multiset predicates to collections.Counter

2020-05-28 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I would also have preferred to use the operators <, >, <=, >=, and ==.  The 
docs in the patch explain why we can't go down this path.

Also, while counters have support for multiset operations, they continue to 
support other use cases a well (negative counts and fractional counts). That 
support can't be removed without breaking existing code that relies on it.

>From the outset, a Counter was just a dictionary that return 0 for missing 
>keys.  Users are free to use that concept however they want.

--
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



[issue40806] itertools.product not lazy

2020-05-28 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee:  -> rhettinger

___
Python tracker 

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



[issue24416] Have date.isocalendar() return a structseq instance

2020-05-28 Thread Petr Viktorin


Petr Viktorin  added the comment:

This broke compilation with mingw; see https://bugs.python.org/issue40777

--
nosy: +petr.viktorin

___
Python tracker 

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



[issue40777] _datetimemodule.c:3328:16: error: initializer element is not constant

2020-05-28 Thread Petr Viktorin


Change by Petr Viktorin :


--
keywords: +patch
nosy: +petr.viktorin
nosy_count: 1.0 -> 2.0
pull_requests: +19742
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/20493

___
Python tracker 

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



[issue38605] [typing] PEP 563: Postponed evaluation of annotations: enable it by default in Python 3.10

2020-05-28 Thread Guido van Rossum


Guido van Rossum  added the comment:

There will still be a lot of code written that way, because people need 
compatibility with earlier versions of Python. So I think it should be fixed in 
get_type_hints().

--

___
Python tracker 

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



[issue40777] _datetimemodule.c:3328:16: error: initializer element is not constant

2020-05-28 Thread Paul Ganssle


Change by Paul Ganssle :


--
nosy: +p-ganssle

___
Python tracker 

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



[issue40801] Expose PyFloat_ToDouble at Python level: operator.as_float?

2020-05-28 Thread Zachary Ware


Zachary Ware  added the comment:

`operator` seems a slightly odd place for this.  My naive expectation would be 
that `float(floatlike_obj)` should do what you want, but it seems that's not 
the case (too permissive of input types?).  So then, what about an alternate 
constructor on the float object, `float.from_floatlike(obj)`?  This could be 
implemented as effectively:

class float:
@classmethod
def from_floatlike(cls, obj):
return cls(PyFloat_FromDouble(PyFloat_AsDouble(obj)))

which would work to get an instance of any float subclass after a round-trip 
through a double.  I have no idea whether that's actually useful, though :)

--
nosy: +zach.ware

___
Python tracker 

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



[issue30064] BaseSelectorEventLoop.sock_{recv, sendall}() don't remove their callbacks when canceled

2020-05-28 Thread Fantix King


Change by Fantix King :


--
pull_requests: +19743
pull_request: https://github.com/python/cpython/pull/20494

___
Python tracker 

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



[issue30064] BaseSelectorEventLoop.sock_{recv, sendall}() don't remove their callbacks when canceled

2020-05-28 Thread Fantix King


Fantix King  added the comment:

Thanks for the comments! Added PR 20494 to properly fix/skip the test for 
(hopefully) all platforms.

--

___
Python tracker 

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



[issue40777] _datetimemodule.c:3328:16: error: initializer element is not constant

2020-05-28 Thread miss-islington


Change by miss-islington :


--
pull_requests: +19744
pull_request: https://github.com/python/cpython/pull/20495

___
Python tracker 

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



  1   2   >