[issue41625] Add splice() to the os module

2020-08-25 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The API of splice() looks complicated. How would you use it in Python?

Are off_in and off_out adjusted as in copy_file_range() and sendfile()? It is 
not clear from the man page. If they are, how would you return updated values?

Are you going to add vmsplice() and tee() too? Since it is Linux-specific API, 
would not be better to add a purposed module linux?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue41628] All unittest.mock autospec-generated methods are coroutine functions

2020-08-25 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +lisroach, xtreak
versions: +Python 3.10, Python 3.9 -Python 3.7

___
Python tracker 

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



[issue41625] Add splice() to the os module

2020-08-25 Thread STINNER Victor


STINNER Victor  added the comment:

> Are you going to add vmsplice() and tee() too? Since it is Linux-specific 
> API, would not be better to add a purposed module linux?

It's not uncommon that a syscall added to the Linux kernel is later added to 
other platforms.

Example: getrandom() exists in Linux and Solaris.

Example: memfd_create() was designed in Linux, and added later to FreeBSD: 
https://github.com/freebsd/freebsd/commit/575e351fdd996f72921b87e71c2c26466e887ed2
 (see bpo-41013).

--

___
Python tracker 

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



[issue37369] Issue with pip in venv on Powershell in Windows

2020-08-25 Thread Federico Tabbò

Federico Tabbò  added the comment:

Hello and sorry for reopening this issue but I have it as well.
The problem is that Powershell has case-sensitive commands and pip is trying to 
call path completely in minor case

PS C:\Users\federico.Tabbo\git\nexus2aci\env\Scripts> .\Activate.ps1
(env) PS C:\Users\federico.Tabbo\git\nexus2aci\env\Scripts>
Fatal error in launcher: Unable to create process using 
'"c:\users\federico.tabbo\git\nexus2aci\env\scripts\python.exe"  
"C:\Users\federico.Tabbo\git\nexus2aci\env\Scripts\pip.exe" ': The system 
cannot find the file specified.


if I run the lowercase path I get an error

(env) PS C:\Users\federico.Tabbo\git\nexus2aci\env\Scripts> 
c:\users\federico.tabbo\git\nexus2aci\env\scripts\python.exe

c:\users\federico.tabbo\git\nexus2aci\env\scripts\python.exe : The term
'c:\users\federico.tabbo\git\nexus2aci\env\scripts\python.exe' is not 
recognized as the name of a cmdlet, function,
script file, or operable program. Check the spelling of the name, or if a path 
was included, verify that the path is
correct and try again.
At line:1 char:1
+ c:\users\federico.tabbo\git\nexus2aci\env\scripts\python.exe
+ 
+ CategoryInfo  : ObjectNotFound: 
(c:\users\federi...ipts\python.exe:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException


Running the correct case path works

(env) PS C:\Users\federico.Tabbo\git\nexus2aci\env\Scripts> 
c:\Users\federico.Tabbo\git\nexus2aci\env\Scripts\python.exe

Python 3.8.4rc1 (tags/v3.8.4rc1:6c38841, Jun 30 2020, 15:17:30) [MSC v.1924 64 
bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

--
nosy: +federico2

___
Python tracker 

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



[issue41625] Add splice() to the os module

2020-08-25 Thread STINNER Victor


STINNER Victor  added the comment:

OpenBSD uses a different API:
https://man.openbsd.org/sosplice.9

int sosplice(struct socket *so, int fd, off_t max, struct timeval *tv);
int somove(struct socket *so, int wait);

"The function sosplice() is used to splice together a source and a drain 
socket."

"The function somove() transfers data from the source's receive buffer to the 
drain's send buffer."

"Socket splicing can be invoked from userland via the setsockopt(2) system-call 
at the SOL_SOCKET level with the socket option SO_SPLICE."

--

___
Python tracker 

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



[issue41625] Add splice() to the os module

2020-08-25 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> The API of splice() looks complicated. How would you use it in Python?

It has the same API as copy_file_range and other similar system calls that we 
already expose, so we just need to do the same thing we do there.

> Are off_in and off_out adjusted as in copy_file_range() and sendfile()? It is 
> not clear from the man page. If they are, how would you return updated values?

It behaves the same as in copy_file_range() with the exception that one has to 
be None (the one associated with the pipe file descriptor). We don't return the 
updated values (neither we do in copy_file_range()).

> Are you going to add vmsplice() and tee() too? Since it is Linux-specific 
> API, would not be better to add a purposed module linux?

We can certainly discuss adding vmsplice() and tee() (probably tee is more 
interesting), but in my humble oppinion that would be a different discussion.

--

___
Python tracker 

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



[issue41625] Add splice() to the os module

2020-08-25 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> OpenBSD uses a different API:

The semantics are considerably different (splice() is about pipes while 
sosplice() talks about general sockets). Also, the point of splice() is to skip 
copying from kernel buffers, but sosplice() does not mention that it does not 
copy between userspace and kernel space

--

___
Python tracker 

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



[issue41625] Add splice() to the os module

2020-08-25 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> Since it is Linux-specific API, would not be better to add a purposed module 
> linux?

This is an interesting point, but I think that at this particular point it 
would be more confusing for users than not (normally people go to the os module 
for system calls) and as Victor mention, we would need to update the os module 
if some other operative system adds the system call later

--

___
Python tracker 

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



[issue40912] _PyOS_SigintEvent is never closed on Windows

2020-08-25 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +corona10

___
Python tracker 

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



[issue41629] __class__ not set defining 'X' as . Was __classcell__ propagated to type.__new__?

2020-08-25 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

The example used to raise deprecation warning in python 3.7

python3.7 -Wall ../backups/bpo41629.py
../backups/bpo41629.py:4: DeprecationWarning: __class__ not set defining 'X' as 
. Was __classcell__ propagated to type.__new__?
  class X(NamedTuple):

It was converted into RuntimeError in 
https://github.com/python/cpython/commit/f5e7b1999f46e592d42dfab51563ea5411946fb7
 . Related https://bugs.python.org/issue23722

--
nosy: +xtreak

___
Python tracker 

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



[issue41629] __class__ not set defining 'X' as . Was __classcell__ propagated to type.__new__?

2020-08-25 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Related SO questions : 

* 
https://stackoverflow.com/questions/61543768/super-in-a-typing-namedtuple-subclass-fails-in-python-3-8
* 
https://stackoverflow.com/questions/41343263/provide-classcell-example-for-python-3-6-metaclass

--

___
Python tracker 

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



[issue41630] Visual Studio does not build the curses and curses.panel module

2020-08-25 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
components: +Windows -Library (Lib)
nosy: +paul.moore, steve.dower, tim.golden, zach.ware

___
Python tracker 

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



[issue41631] _ast module: get_global_ast_state() doesn't work with Mercurial lazy import

2020-08-25 Thread STINNER Victor


New submission from STINNER Victor :

Building Mercurial with Python 3.9.0rc1 fails with the error:

SystemError:  returned NULL without setting an error

The problem comes from the PyAST_Check() function. This function calls 
get_global_ast_state() which gets the state of the _ast module. If the module 
is not imported yet, it is imported.

The problem is that Mercurial monkey-patches the __import__() builtin function 
to implement lazy imports. get_global_ast_state() calls PyImport_Import() which 
returns a Mercurial _LazyModule(__name__='_ast', ...) object. Calling 
get_ast_state() (PyModule_GetState()) on it is unsafe since it's not the _ast 
extension module, but another module (which has no state, PyModule_GetState() 
returns NULL).

https://bugzilla.redhat.com/show_bug.cgi?id=1871992#c1

--

The _ast extension module was modified multiple times recently:

* September 2019: The extension was converted to PEP 384 (stable ABI): 
bpo-38113, commit ac46eb4ad6662cf6d771b20d8963658b2186c48c
* July 2020: The extension was converted to PEP 489 (multiphase init): 
bpo-41194, commit b1cc6ba73a51d5cc3aeb113b5e7378fb50a0e20a
* (and bugfixes: see bpo-41194 and bpo-41204)

I did the PEP 489 change to fix a regression caused by the first change (PEP 
384), two bugs in fact:

* bpo-41194 Python 3.9.0b3 crash on compile() in PyAST_Check() when the _ast 
module is loaded more than once
* bpo-41261: 3.9-dev SEGV in object_recursive_isinstance in ast.literal_eval

--
components: Library (Lib)
messages: 375881
nosy: vstinner
priority: release blocker
severity: normal
status: open
title: _ast module: get_global_ast_state() doesn't work with Mercurial lazy 
import
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



[issue38113] Remove statics from ast.c

2020-08-25 Thread STINNER Victor


STINNER Victor  added the comment:

> This change introduced a subtle regression: bpo-41194. I modified the _ast 
> module to use again a global state: (...)

Sadly, my fix doesn't work in all cases, there is yet another bug: bpo-41631 
"_ast module: get_global_ast_state() doesn't work with Mercurial lazy import".

--

___
Python tracker 

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



[issue41631] _ast module: get_global_ast_state() doesn't work with Mercurial lazy import

2020-08-25 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
nosy: +BTaskaya

___
Python tracker 

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



[issue41631] _ast module: get_global_ast_state() doesn't work with Mercurial lazy import

2020-08-25 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +corona10

___
Python tracker 

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



[issue41631] _ast module: get_global_ast_state() doesn't work with Mercurial lazy import

2020-08-25 Thread STINNER Victor


STINNER Victor  added the comment:

One option is to revert all AST changes of bpo-38113 (and following changes), 
to move back to the state before bpo-38113, until all issues are addressed.

--

___
Python tracker 

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



[issue41631] _ast module: get_global_ast_state() doesn't work with Mercurial lazy import

2020-08-25 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Given how close are we to a release for 3.9 we should try to maximize stability.

--

___
Python tracker 

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



[issue41631] _ast module: get_global_ast_state() doesn't work with Mercurial lazy import

2020-08-25 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
nosy: +pablogsal

___
Python tracker 

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



[issue41598] Adding support for rounding modes to builtin round

2020-08-25 Thread Mark Dickinson


Mark Dickinson  added the comment:

> I don't think that this will be a very difficult feature to implement.

Agreed that it shouldn't be hard to implement, if we do the obvious thing 
(rounding the exact value that the float represents, rather than trying to do 
some sort of Do What I Mean rounding). But I'm far from convinced that it's a 
good idea. I think it'll increase user confusion and generate lots of spurious 
"Python's round is broken" bug reports.

To be clear: supporting rounding modes for rounding from float to integer is 
fine (i.e., supporting the ndigits=0 case, or the case where ndigits is not 
supplied at all). The confusion is going to arise with rounding to a particular 
number of decimal places with a given rounding mode.

Note: there are two parts to this - the first part is figuring out what 
functionality we want. The second part is figuring out how best to spell it 
(separate functions versus keyword arguments to round, etc.). I'm mostly 
ignoring the second part for now and concentrating on the first part. There's a 
lot to discuss with the second part too (e.g., how does the __round__ protocol 
change, in a way that doesn't break 3rd party types already using it; how do we 
specify rounding modes, etc.), but it doesn't seem so useful to have that 
discussion until the first part is figured out.

Two examples to illustrate, one with a round-to-nearest rounding mode, one with 
a directed rounding mode:

- What would you expect round(2.675, ndigits=2, mode=ROUND_HALF_UP) to give? I 
strongly suspect that Marco would expect and want a result of 2.68. But if we 
follow the existing rules for round, it's going to give 2.67.

- What would you expect round(2.712, ndigits=3, mode=ROUND_UP) to give? The 
binary float given by the literal 2.712 is just a touch larger than 2.712, so 
it should round up, giving 2.713. But again, I doubt that's what users will 
expect or want.  Even worse, the rounding is not idempotent: the float 2.713 is 
again a little larger than Decimal("2.713"), so it rounds up again: so if we 
round the value 2.712 twice to 3 digits using ROUND_UP, we'll get 2.714.

Tricks like the power of 10 scaling in the original post aren't really a 
solution: they just serve to make it even less predictable when the users' 
expected result will appear and when it won't, and likely give a false sense of 
security.

If we were to implement this, there's a choice to be made: do we (1) base the 
rounding on the actual float value and do correct rounding, as round currently 
does, or do we (2) try to do something magic that guesses what value the user 
actually meant, rather than rounding the exact value that the round function 
receives? I _really_ _really_ don't want to go down the DWIM path of option 
(2), but I suspect that (1) will be mostly useless for users, outside the 
ndigits=0 use-case. There _are_ valid use-cases for two-argument round on 
floats (e.g., casual binning), but for the most part round already fills those 
use-cases.

I'd rather add whatever bells and whistles we need (if any) to make it easier 
for users who care about this to use Decimal.

--

___
Python tracker 

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



[issue40573] inspect.iscorutinefunction() returns False for unittest.mock.AsyncMock instances

2020-08-25 Thread Irit Katriel


Irit Katriel  added the comment:

The two implementations of iscoroutinefunction are implemented differently: 

in inspect:
def iscoroutinefunction(obj):
"""Return true if the object is a coroutine function.
Coroutine functions are defined with "async def" syntax.
"""
return _has_code_flag(obj, CO_COROUTINE)

and in asyncio: 
def iscoroutinefunction(func):
"""Return True if func is a decorated coroutine function."""
return (inspect.iscoroutinefunction(func) or
getattr(func, '_is_coroutine', None) is _is_coroutine)


originally the asyncio version had only the _is_coroutine check:
https://github.com/python/cpython/commit/f951d28ac890063e3ecef56aa8cf851b1152d9dd

the inspect check was added later.

See also issue28703, where the asyncio version was fixed to handle mock 
objects.  Looks like the inspect version needs to be fixed as well.

--
nosy: +iritkatriel

___
Python tracker 

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



[issue40573] inspect.iscorutinefunction() returns False for unittest.mock.AsyncMock instances

2020-08-25 Thread Irit Katriel


Change by Irit Katriel :


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



[issue41598] Adding support for rounding modes to builtin round

2020-08-25 Thread Vedran Čačić

Vedran Čačić  added the comment:

> I'd rather add whatever bells and whistles we need (if any) to make it easier 
> for users who care about this to use Decimal.

This made me think. (I have tons of these ideas, but usually am afraid of 
voicing them unless encouraged by comments such as this one.;) How about this 
whistle: we allow round to accept str as the first argument?

In a very unrelated context 
(https://www.python.org/dev/peps/pep-0484/#forward-references) Guido has said 
something like "when literals aren't what they seem, strings are a good enough 
substitute". Maybe here too?

--

___
Python tracker 

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



[issue41632] Tkinter - Unexpected behavior after creating around 10000 widgets

2020-08-25 Thread Jonathan Lahav


New submission from Jonathan Lahav :

Observation:
After creating around 1 widgets (verified with ttk.Label), no more widgets 
get created, and sometimes graphical artifacts appear outside the application 
window.

No error message or exception is raised.

Expected:
Either the limit can be removed (having dynamically created 1 widgets in 
data heavy applications is sometimes desired), or at least document and return 
runtime errors to prevent the weird behavior.

Reproduction:
This is the problematic part:
for _ in range(1):
ttk.Label(root, text='problematic')

A full minimal example code is attached, though a better effect can be seen 
when running the above two lines in the context of a more advanced Tkinter 
application.

--
components: Tkinter
files: ten_k.py
messages: 375888
nosy: gpolo, j.lahav, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Tkinter - Unexpected behavior after creating around 1 widgets
type: crash
versions: Python 3.8
Added file: https://bugs.python.org/file49426/ten_k.py

___
Python tracker 

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



[issue41632] Tkinter - Unexpected behavior after creating around 10000 widgets

2020-08-25 Thread E. Paine


E. Paine  added the comment:

I am struggling to reproduce. On Linux the window shows exactly as expected (it 
does take a while to close, though, which is understandable) and on Windows the 
window never shows (it gets stuck before the mainloop). This is, however, not a 
tkinter problem as I get exactly the same result on each platform running the 
following equivalent Tcl in Wish:

for {set i 0} {$i < 1} {incr i} {
ttk::label ".l$i" -text problematic
}
grid [ttk::label .lb -text {now you see me}]

A similar issue was reported in #37673. If you *need* lots of widgets (e.g. a 
large table) I would suggest lazy loading them instead of trying to render them 
all at load. Thank you for reporting this issue but it should be closed as 
third-party.

A note for future: please could you include information about your environment 
(Python version, Tk patchlevel, OS, etc.) so it is easier for the problem to be 
narrowed down (again, thank you for reporting this issue).

--
nosy: +epaine
Added file: https://bugs.python.org/file49427/ten_k.tcl

___
Python tracker 

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



[issue40077] Convert static types to PyType_FromSpec()

2020-08-25 Thread Dong-hee Na


Change by Dong-hee Na :


--
pull_requests: +21062
pull_request: https://github.com/python/cpython/pull/21953

___
Python tracker 

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



[issue40077] Convert static types to PyType_FromSpec()

2020-08-25 Thread Dong-hee Na


Change by Dong-hee Na :


--
pull_requests: +21063
pull_request: https://github.com/python/cpython/pull/21954

___
Python tracker 

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



[issue41594] Intermittent failures of loop.subprocess_exec() to capture output

2020-08-25 Thread Yaroslav Halchenko


Yaroslav Halchenko  added the comment:

Might (although unlikely) be related to https://bugs.python.org/issue40634 
which is about BlockingIOError being raised (and ignored) if SelectorEventLoop 
is reused (not the case here) also in the case of short lived processes.

--
nosy: +Yaroslav.Halchenko

___
Python tracker 

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



[issue41633] pydoc skips methods of nested classes

2020-08-25 Thread Bob Kline


New submission from Bob Kline :

Although the documentation for the pydoc says that it produces documentation of 
the classes recursively, this isn't actually true.

--
components: Library (Lib)
files: repro.py
messages: 375891
nosy: bkline
priority: normal
severity: normal
status: open
title: pydoc skips methods of nested classes
type: behavior
versions: Python 3.8
Added file: https://bugs.python.org/file49428/repro.py

___
Python tracker 

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



[issue41633] pydoc skips methods of nested classes

2020-08-25 Thread Bob Kline


Bob Kline  added the comment:

Here is the generated documentation. Note that no mention is made of the inner 
class's method.

--
Added file: https://bugs.python.org/file49429/Screen Shot 2020-08-25 at 
11.26.39 AM.png

___
Python tracker 

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



[issue37369] Issue with pip in venv on Powershell in Windows

2020-08-25 Thread Steve Dower


Steve Dower  added the comment:

> The problem is that Powershell has case-sensitive commands and pip is trying 
> to call path completely in minor case

This is not normal configuration. I'm not sure what you've done here, but 
please open a new issue with details about how you enabled case-sensitivity on 
Windows.

Also please include repro steps that do not involve pip, as we will need an 
issue in CPython to fix anything. Otherwise you'll have to report it to the pip 
project at https://github.com/pypa/pip

--

___
Python tracker 

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



[issue40573] inspect.iscorutinefunction() returns False for unittest.mock.AsyncMock instances

2020-08-25 Thread Irit Katriel


Change by Irit Katriel :


--
nosy: +yselivanov

___
Python tracker 

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



[issue41631] _ast module: get_global_ast_state() doesn't work with Mercurial lazy import

2020-08-25 Thread hai shi


Change by hai shi :


--
nosy: +shihai1991

___
Python tracker 

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



[issue41625] Add splice() to the os module

2020-08-25 Thread hai shi


Change by hai shi :


--
nosy: +shihai1991

___
Python tracker 

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



[issue41630] Enable curses support on Windows

2020-08-25 Thread Steve Dower


Steve Dower  added the comment:

The curses module is currently not supported on Windows, and this patch is far 
more than just updating the VS build. I've updated the title.

Refer to issue31951 for more context.

This will need more work than what's been done in the pull request, as _curses 
is still not being built as part of normal build, and so is not being tested in 
CI.

--
title: Visual Studio does not build the curses and curses.panel module -> 
Enable curses support on Windows
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



[issue41634] Typo in curses documentation

2020-08-25 Thread pipythonmc


New submission from pipythonmc :

https://docs.python.org/3/library/curses.html#curses.window.addch

"overwriting any character previously painter"

I believe it should be

"overwriting any character previously painted"

Also this is my first issue so if I made any mistakes please tell me.
I am using Google Chrome 84.0.4147.135 (Official Build) (64-bit) but this 
shouldn't affect anything.

--
assignee: docs@python
components: Documentation
messages: 375895
nosy: docs@python, pipythonmc
priority: normal
severity: normal
status: open
title: Typo in curses documentation
type: enhancement
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



[issue41585] policy.max_line_length is incorrectly assumed to never be None

2020-08-25 Thread Sebastien Williams-Wynn


Change by Sebastien Williams-Wynn :


--
keywords: +patch
nosy: +s.williams-wynn
nosy_count: 6.0 -> 7.0
pull_requests: +21064
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21955

___
Python tracker 

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



[issue41602] Python doesn't exit with proper resultcode on SIGINT in runpy (pymain_run_module)

2020-08-25 Thread Thomas Grainger


Change by Thomas Grainger :


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

___
Python tracker 

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



[issue29988] with statements are not ensuring that __exit__ is called if __enter__ succeeds

2020-08-25 Thread jack1142


Change by jack1142 :


--
nosy: +jack1142

___
Python tracker 

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



[issue41513] High accuracy math.hypot()

2020-08-25 Thread Tim Peters


Tim Peters  added the comment:

One more implication: since the quality of the initial square root doesn't 
really much matter, instead of

result = sqrt(to_float(parts))
a, b = split(result)
parts = add_on(-a*a, parts)
parts = add_on(-2.0*a*b, parts)
parts = add_on(-b*b, parts)
x = to_float(parts)
result += x / (2.0 * result)

at the end, it should work just as well (in fact, probably a little better, due 
to getting more beneficial cancellation) to do:

a = parts[0] - 1.0
result = sqrt(a)
x, y = split(result)
result += (a - x*x - 2.0*x*y - y*y + parts[1]) / (2.0 * result)

at the end. Although this crucially relies on the doing the last-line chain of 
subtracts and adds "left to right".

--

___
Python tracker 

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



[issue41602] Python doesn't exit with proper resultcode on SIGINT in runpy (pymain_run_module)

2020-08-25 Thread Thomas Grainger


Thomas Grainger  added the comment:

I've confirmed that the pymain_run_module fails on master in the same way with 
Mac, Windows and Ubuntu

--

___
Python tracker 

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



[issue41632] Tkinter - Unexpected behavior after creating around 10000 widgets

2020-08-25 Thread Jonathan Lahav


Jonathan Lahav  added the comment:

Thank you for checking it so quickly, and answering nicely.

I indeed forgot to mention that it happened to me on Windows. Sorry for that.

The issue seems similar to the one you linked. I will try and take this to the 
TCL community since it impacts our product. Thank you for translating the code 
to TCL.

If the python community has no interest in trying to push TCL to fix it, this 
issue can be closed.

Thanks!

--

___
Python tracker 

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



[issue41635] flaky test.test_asyncio.test_events.ProactorEventLoopTests.test_call_later

2020-08-25 Thread Thomas Grainger


New submission from Thomas Grainger :

==
FAIL: test_call_later (test.test_asyncio.test_events.ProactorEventLoopTests)
--
Traceback (most recent call last):
  File "D:\a\cpython\cpython\lib\test\test_asyncio\test_events.py", line 301, 
in test_call_later
self.assertTrue(0.08 <= t1-t0 <= 0.8, t1-t0)
AssertionError: False is not true : 0.078020191

--

https://github.com/python/cpython/pull/21956/checks?check_run_id=1028726196#step:5:4892

--
components: Tests
messages: 375900
nosy: graingert
priority: normal
severity: normal
status: open
title: flaky 
test.test_asyncio.test_events.ProactorEventLoopTests.test_call_later
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



[issue37980] regression when passing numpy bools to sorted(..., reverse=r)

2020-08-25 Thread lizardlizard


lizardlizard  added the comment:

I found this bug searching after noticing weird behaviour in an error message 
saying sorted expects the reverse flag to be an integer, after it rejected 
None. This is very surprising. Why isn't it just casting the reverse parameter 
using bool() to discover it's truthyness?

In [1]: bool(None)
Out[1]: False

In [2]: sorted(['a','c','b'], reverse=None)
---
TypeError Traceback (most recent call last)
 in ()
> 1 sorted(['a','c','b'], reverse=None)

TypeError: an integer is required (got type NoneType)

--
nosy: +lizardlizard

___
Python tracker 

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



[issue25229] distutils doesn't add "-Wl, " prefix to "-R" on Linux if the C compiler isn't named 'gcc'

2020-08-25 Thread Kenta Tsubouchi


Change by Kenta Tsubouchi :


--
pull_requests: +21067
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21957

___
Python tracker 

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



[issue41636] distutils.util.strtobool documented behaviour

2020-08-25 Thread Graham Oliver


New submission from Graham Oliver :

Here is the text 

https://docs.python.org/3.6/distutils/apiref.html#distutils.util.strtobool

Convert a string representation of truth to true (1) or false (0).

True values are y, yes, t, true, on and 1; false values are n, no, f, false, 
off and 0. Raises ValueError if val is anything else.

I wondered what would happen with 'FALSE' i.e. upper case. It appears to behave 
the same way as 'false'. In fact case does not seem to be an issue, so 'FaLsE' 
will return 0 as well.

So a note that this function is independent of case may be helpful

--
assignee: docs@python
components: Documentation
messages: 375902
nosy: Graham.Oliver, docs@python
priority: normal
severity: normal
status: open
title: distutils.util.strtobool documented behaviour
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



[issue30434] multiprocessing AuthenticationError "digest sent was rejected"

2020-08-25 Thread Xiang Zhang


Change by Xiang Zhang :


--
resolution:  -> out of date
stage: test needed -> 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



[issue41636] distutils.util.strtobool documented behaviour

2020-08-25 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +dstufft, eric.araujo

___
Python tracker 

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



[issue41634] Typo in curses documentation

2020-08-25 Thread Zackery Spytz


Change by Zackery Spytz :


--
keywords: +patch
nosy: +ZackerySpytz
nosy_count: 2.0 -> 3.0
pull_requests: +21068
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21958

___
Python tracker 

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



[issue41598] Adding support for rounding modes to builtin round

2020-08-25 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Like Mark, I'm not convinced this is a good idea.  

Outside of finance calculations which typically already use decimal, the need 
for it is somewhat rare.  Also, the API doesn't fit neatly with existing the 
__round__ dunder methods, so the new feature couldn't be made to work with 
existing classes.

If you want to pursue this, I recommend taking it to python-ideas.

--

___
Python tracker 

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



[issue41637] Calling a function with an infinite number of parameters is not detected and crash the interpreter instead of causing an exception

2020-08-25 Thread Camion


New submission from Camion :

The following code will obviously cause a memory leak, but this will not be 
detected and crash the interpreter:

def inf():
  while True: yield 0

def use(*parm):
  for i in parm: print(i)

and then

use(*inf())

or 

print(*int())

The reason of this test is that I wanted to check if ever python would be able 
to make lazy evaluation in parameter passing (It would be nice if it was but it 
is not the case). However, at least, I think this error should have been 
detected as well as an infinite recursion is, because it even has been able to 
crash and reboot a not so old (18) version of linux Mint.

--
components: Interpreter Core
messages: 375904
nosy: Camion
priority: normal
severity: normal
status: open
title: Calling a function with an infinite number of parameters is not detected 
and crash the interpreter instead of causing an exception
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



[issue41548] Tk Window rendering on macOS Big Sur

2020-08-25 Thread Roger Meier


Roger Meier  added the comment:

The latest macOS Big Sur Public Beta (5, Build 20A5354i) fixes the issue with 
TK Window rendering.

--
resolution:  -> works for me

___
Python tracker 

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



[issue41638] Error message: sqlite3.ProgrammingError: You did not supply a value for binding # might be improved

2020-08-25 Thread Wolfgang Fahl


New submission from Wolfgang Fahl :

def testBindingError(self):
'''
test list of Records with incomplete record leading to
"You did not supply a value for binding 2"
'''
listOfRecords=[{'name':'Pikachu', 'type':'Electric'},{'name':'Raichu' }]
resultList=self.checkListOfRecords(listOfRecords,'Pokemon','name')

Which eventually will call:
   
   insertCmd=entityInfo.insertCmd
   self.c.executemany(insertCmd,listOfRecords)
   self.c.commit()

leading to the error message:

sqlite3.ProgrammingError: You did not supply a value for binding 2.

When many thousand records are inserted this message is not very helpful. 

you might want to improve it to:
sqlite3.ProgrammingError: You did not supply a value for binding 2 ("type") in 
record #2 with a debug option that shows the actual date like:
sqlite3.ProgrammingError: You did not supply a value for binding 2 ("type") in 
record #2 debuginfo: name="Raichu", type=missing




sqlite3.ProgrammingError: You did not supply a value for binding 2.

--
components: Library (Lib)
messages: 375906
nosy: WolfgangFahl
priority: normal
severity: normal
status: open
title: Error message: sqlite3.ProgrammingError: You did not supply a value for 
binding # might be improved
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



[issue41638] Error message: sqlite3.ProgrammingError: You did not supply a value for binding # might be improved

2020-08-25 Thread Wolfgang Fahl


Wolfgang Fahl  added the comment:

My workaround starts with:
try:
self.c.executemany(insertCmd,listOfRecords)
self.c.commit()
except sqlite3.ProgrammingError as pe:
msg=pe.args[0]
if "You did not supply a value for binding" in msg:
columnIndex=int(re.findall(r'\d+',msg)[0])
columnName=list(entityInfo.typeMap.keys())[columnIndex-1]
raise Exception("%s\nfailed: no value supplied for column '%s'" 
% (insertCmd,columnName))
else:
raise pe

which gives me:

Exception: INSERT INTO Pokemon (name,type) values (:name,:type)
failed: no value supplied for column 'type'

but not the data yet. So i am now forced to implement another insert that does 
not use executemany (which i like a lot) just to get proper debug information - 
this is a pitty.

--

___
Python tracker 

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



[issue41638] Error message: sqlite3.ProgrammingError: You did not supply a value for binding # might be improved

2020-08-25 Thread Wolfgang Fahl


Wolfgang Fahl  added the comment:

see https://github.com/WolfgangFahl/DgraphAndWeaviateTest/issues/7 and 
https://github.com/WolfgangFahl/DgraphAndWeaviateTest/commit/cc7dbc4c3ade4dd6b2e74f41410e19bc21450490

--

___
Python tracker 

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



[issue41639] Unpickling derived class of list does not call __init__()

2020-08-25 Thread Andy Maier


New submission from Andy Maier :

Unpickling an object of a user class that derives from list seems to miss 
calling the user class's __init__() method:

Consider this script, which defines a derived class of the built-in list for 
the purpose of creating a case insensitive list. The real example has all 
methods of list implemented, but this subset example also shows the issue:

-
import pickle

def _lc_list(lst):
result = list()
for value in lst:
result.append(value.lower())
return result

class NocaseList(list):

#def __new__(cls, iterable=()):
#self = super(NocaseList, cls).__new__(cls, iterable)
#print("Debug: __new__()  for self={}".format(id(self)))
#return self

def __init__(self, iterable=()):
print("Debug: __init__() for self={}".format(id(self)))
super(NocaseList, self).__init__(iterable)
self.lc_list = _lc_list(self)

def append(self, value):
super(NocaseList, self).append(value)
self.lc_list.append(value.lower())

def extend(self, iterable):
super(NocaseList, self).extend(iterable)
for value in iterable:
self.lc_list.append(value.lower())

ncl = NocaseList(['A', 'b'])
pkl = pickle.dumps(ncl)
nclx = pickle.loads(pkl)
-

$ python ./pickle_extend.py 
Debug: __init__() for self=4498704880
Traceback (most recent call last):
  File "./pickle_extend.py", line 32, in 
nclx = pickle.loads(pkl)
  File "./pickle_extend.py", line 28, in extend
self.lc_list.append(value.lower())
AttributeError: 'NocaseList' object has no attribute 'lc_list'

Uncommenting the __new__() method in the script shows that __new__() is called 
but not __init__():

$ python ./pickle_extend.py 
Debug: __new__()  for self=4359683024
Debug: __init__() for self=4359683024
Debug: __new__()  for self=4360134304
Traceback (most recent call last):
  File "./pickle_extend.py", line 32, in 
nclx = pickle.loads(pkl)
  File "./pickle_extend.py", line 28, in extend
self.lc_list.append(value.lower())
AttributeError: 'NocaseList' object has no attribute 'lc_list'

--
messages: 375909
nosy: andymaier
priority: normal
severity: normal
status: open
title: Unpickling derived class of list does not call __init__()
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



[issue41638] Error message: sqlite3.ProgrammingError: You did not supply a value for binding # might be improved

2020-08-25 Thread Wolfgang Fahl


Wolfgang Fahl  added the comment:

The full workaround is in 
https://github.com/WolfgangFahl/DgraphAndWeaviateTest/commit/f1a58d75f459bf78db327acddaf01d5cf64eb7d4

def testBindingError(self):
'''
test list of Records with incomplete record leading to
"You did not supply a value for binding 2"
see https://bugs.python.org/issue41638
'''
listOfRecords=[{'name':'Pikachu', 'type':'Electric'},{'name':'Raichu' }]
for executeMany in [True,False]:
try:

self.checkListOfRecords(listOfRecords,'Pokemon','name',executeMany=executeMany)
self.fail("There should be an exception")
except Exception as ex:
if self.debug:
print(str(ex))
self.assertTrue('no value supplied for column' in str(ex))   

Giving the error messages:

INSERT INTO Pokemon (name,type) values (:name,:type)
failed: no value supplied for column 'type'

in mode "executeMany"

INSERT INTO Pokemon (name,type) values (:name,:type)
failed: no value supplied for column 'type'
record  #2={'name': 'Raichu'}

if executeMany is not used and errorDebug is on

The wrapper code is:

def store(self,listOfRecords,entityInfo,executeMany=False):
'''
store the given list of records based on the given entityInfo

Args:
  
   listOfRecords(list): the list of Dicts to be stored
   entityInfo(EntityInfo): the meta data to be used for storing
'''
insertCmd=entityInfo.insertCmd
try:
if executeMany:
self.c.executemany(insertCmd,listOfRecords)
else:
index=0
for record in listOfRecords:
index+=1
self.c.execute(insertCmd,record)
self.c.commit()
except sqlite3.ProgrammingError as pe:
msg=pe.args[0]
if "You did not supply a value for binding" in msg:
columnIndex=int(re.findall(r'\d+',msg)[0])
columnName=list(entityInfo.typeMap.keys())[columnIndex-1]
debugInfo=""
if not executeMany:
if self.errorDebug:
debugInfo="\nrecord  #%d=%s" % (index,repr(record))
raise Exception("%s\nfailed: no value supplied for column 
'%s'%s" % (insertCmd,columnName,debugInfo))
else:
raise pe

--

___
Python tracker 

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



[issue41638] Error message: sqlite3.ProgrammingError: You did not supply a value for binding # might be improved

2020-08-25 Thread Wolfgang Fahl


Wolfgang Fahl  added the comment:

see also 
https://stackoverflow.com/questions/61788055/sqlite3-error-you-did-not-supply-a-value-for-binding-1

--

___
Python tracker 

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



[issue32313] Wrong inspect.getsource for datetime

2020-08-25 Thread శ్రీనివాస్ రెడ్డి తాటిపర్తి

Srinivas  Reddy Thatiparthy(శ్రీనివాస్ రెడ్డి తాటిపర్తి) 
 added the comment:

Looks like for `getfile` docs should be updated. On python2.7.17_1, 

  import inspect, datetime
  print(inspect.getfile(datetime.datetime)) outputs, 

/usr/local/Cellar/python@2/2.7.17_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/datetime.so

It seems a long time overdue?

--
nosy: +thatiparthy

___
Python tracker 

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