[issue36971] Add subsections in C API "Common Object Structures" page

2019-10-29 Thread Dino Viehland


Dino Viehland  added the comment:

@BTaskaya Seems done, I'll go ahead and close it

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



[issue38382] statistics.harmonic_mean fails to raise error with negative input that follows a 0

2019-10-29 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Thank you for your comments, but accepting non-floats like Decimal and 
Fraction (and int, of course!) is a hard requirement for the statistics 
module. fmean will naturally convert any data to float for speed, but 
the other means will attempt to keep the original data type if possible, 
so that the mean() of Decimals will be a Decimal, the mean of Fractions 
will be a Fraction, etc.

The median_low and median_high functions don't require numbers at all, 
the data points just need to be ordinal data and support sorting. The 
mode function doesn't even require ordinal data, it can work with 
nominal data. That is part of the definition of median and mode, and 
will not change.

http://intellspot.com/nominal-vs-ordinal-data/

So long as Python support IEEE-754 floating point arithmetic, which is 
the most common standard for floating point, there will be NANs and 
INFs. We should not reject them unnecessarily. You can always pre-filter 
your data before passing it the statistics module.

Why do you object to float INF?

--

___
Python tracker 

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



[issue38382] statistics.harmonic_mean fails to raise error with negative input that follows a 0

2019-10-29 Thread gaoxinge


gaoxinge  added the comment:

The document 
https://github.com/WarrenWeckesser/cpython/blob/master/Lib/statistics.py#L389 
in `harmonic_mean` is out-dated. I think we can simply follow the wiki:

- [arithemic mean](https://en.wikipedia.org/wiki/Arithmetic_mean)
- [geometric mean](https://en.wikipedia.org/wiki/Geometric_mean)
- [harmonic mean](https://en.wikipedia.org/wiki/Harmonic_mean)

--

___
Python tracker 

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



[issue38382] statistics.harmonic_mean fails to raise error with negative input that follows a 0

2019-10-29 Thread gaoxinge


gaoxinge  added the comment:

I think that three kinds of mean should behave like:

- `geometric mean`: input should be float, finite and positive
- `harmonic mean`: input should be float, finite and nonzero
- `mean` or `fmean`: input should be float, finite

Otherwise these mean functions should raise a `StatisticsError`. 

Two points that we should pay attention to:

- Why every input should be float? Because it is a statstics library, we should 
focus on the float instead of complex number or string or `math.nan`.

- Why every input shoud be finite? Becuse we should get rid of `math.inf`.

--
nosy: +gaoxinge

___
Python tracker 

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



[issue38637] fix GROWTH_RATE comments bug

2019-10-29 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Please explain the bug here on the bug tracker, people shouldn't have to drill 
down into the PR to find out what it means.

Before fixing the bug, you should find out whether or not it actually is a bug. 
In my testing, the comment is approximately correct:

py> from random import random
py> d = dict((random(), None) for i in range(20))
py> sys.getsizeof(d)
432
py> while sys.getsizeof(d) == 432:
... d[random()] = None
...
py> sys.getsizeof(d)
816


That looks closer to double than triple to me. Try a larger dict:

py> for i in range(1):
... d[random()] = None
...
py> sys.getsizeof(d)
196656
py> while sys.getsizeof(d) == 196656:
... d[random()] = None
...
py> sys.getsizeof(d)
393264

Still looks like double to me.

Unless an expert on the dict internals agrees with you, the comment is correct, 
it is not a bug, and this issue should be closed.

--
nosy: +steven.daprano

___
Python tracker 

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



[issue38611] ElementTree.ParseError does not implement SyntaxError interface as expected

2019-10-29 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +scoder

___
Python tracker 

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



[issue38637] fix GROWTH_RATE comments bug

2019-10-29 Thread toywei


New submission from toywei :

It also exists in 3.7/3.6/3.3.

--
assignee: docs@python
components: Documentation
messages: 355688
nosy: docs@python, toywei
priority: normal
pull_requests: 16516
severity: normal
status: open
title: fix GROWTH_RATE comments bug
type: resource usage
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



[issue38382] statistics.harmonic_mean fails to raise error with negative input that follows a 0

2019-10-29 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Maybe we should hold-off on adding negative number support unless a compelling 
use case arises.  It is telling that scipy.stats.hmean() and that MS Excel's 
harmean() haven't found justification to add negative number support.

In all likelihood, a negative input is an error in the input and users would be 
better-off seeing an exception raised.  In a number of contexts, the negative 
input wouldn't make sense all:

* a 10 ohm resistor wired in parallel with a negative 5 ohm resistor
* travel 1 km at 5 kph then another 1 km at -10 kph

We really don't have to go down this route just because we can.  The usual rule 
is to keep the API minimal unless real use cases arise to inform the design.

--

___
Python tracker 

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



[issue37957] Allow regrtest to receive a file with test (and subtests) to ignore

2019-10-29 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue38611] ElementTree.ParseError does not implement SyntaxError interface as expected

2019-10-29 Thread Jim Carroll


Jim Carroll  added the comment:

This patch solves the issue

diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c
index c3f30c9339..d265021f75 100644
--- a/Modules/_elementtree.c
+++ b/Modules/_elementtree.c
@@ -2782,6 +2782,7 @@ treebuilder_handle_start(TreeBuilderObject* self, 
PyObject* tag,
 st->parseerror_obj,
 "multiple elements on top level"
 );
+   PyErr_SyntaxLocationEx("xml.etree.ElementTree", 0, 0);
 goto error;
 }
 Py_INCREF(node);
@@ -3267,6 +3268,7 @@ expat_set_error(enum XML_Error error_code, Py_ssize_t 
line, Py_ssize_t column,
 Py_DECREF(position);

 PyErr_SetObject(st->parseerror_obj, error);
+   PyErr_SyntaxLocationEx("xml.etree.ElementTree", (int)line, (int)column);
 Py_DECREF(error);
 }

--

___
Python tracker 

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



[issue28029] Replace and empty strings

2019-10-29 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
Removed message: https://bugs.python.org/msg355681

___
Python tracker 

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



[issue28029] Replace and empty strings

2019-10-29 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
Removed message: https://bugs.python.org/msg355679

___
Python tracker 

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



[issue38312] curses: add `set_tabsize` and `set_escdelay`

2019-10-29 Thread Anthony Sottile


Anthony Sottile  added the comment:

ah, I'll add those too -- I can do that in the current PR

--

___
Python tracker 

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



[issue38568] [3.7.5 x86_64 Linux] f-string parsing results in EOL

2019-10-29 Thread Eric V. Smith


Eric V. Smith  added the comment:

> It is a limitation of f-strings, though. We're not allowed to use
> backslashes within the f-string expression in curly braces.

I've considered relaxing these restrictions, although it's very complicated. 
The parser would need to become aware of what's inside an f-string (the braces, 
the expressions, the optional format spec, the doubled braces, escaped 
characters, etc.). See PEP 536 for a rough outline. The = format for 
"debugging" with f-strings (see issue 36817) also makes this more complicated.

--
nosy: +eric.smith

___
Python tracker 

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



[issue38312] curses: add `set_tabsize` and `set_escdelay`

2019-10-29 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

There are also ncurses functions get_tabsize() and get_escdelay(). In other 
implementations they can be modeled by returning the TABSIZE and ESCDELAY 
global variables.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue37839] makesetup Doesn't Handle Defines with Equal Sign

2019-10-29 Thread Jamie Bliss


Jamie Bliss  added the comment:

Similarly, stumbled across this working on 
https://github.com/pyz-dispenser/cpython-static

This is particularly problematic because of the SQLite module's MODULE_NAME 
macro.

--
nosy: +astronouth7303

___
Python tracker 

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



[issue28029] Replace and empty strings

2019-10-29 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Raymond, the link is about str.split(), not str.replace().

--

___
Python tracker 

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



[issue38453] ntpath.realpath() does not fully resolve relative paths

2019-10-29 Thread Steve Dower


Steve Dower  added the comment:

The discussion on the PR has raised one scenario where our algorithm conflicts 
with what we can reasonably emulate from the IO manager (which is itself not 
entirely self-consistent):

If you call ntpath.realpath(r"C:\spam\eggs") where "spam" is a symlink/junction 
to "D:\foo\baz" and "D:\foo\baz\eggs" is a relative symlink to "..\bar" and 
"D:\foo\bar" does not exist, we will incorrectly return "C:\bar".

Note that if "D:\foo\bar" *does* exist, we will return the correct result. And 
if "C:\spam" is *not* a symlink/junction, we will return the correct result.

Essentially, we fail in the case where ntpath.exists(X) fails and 
realpath(dirname(X)) != dirname(X) and readlink(X).startswith("..\\") is True.

Considering it's taken months of patient explanation from Eryk Sun for me to 
understand this, and nobody has ever complained about it, I'm prepared to call 
it a known limitation.

--

___
Python tracker 

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



[issue28029] Replace and empty strings

2019-10-29 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

The current docs could certainly use clarification.

FWIW, here is a link to my explanation for the existing logic in str.replace(): 
 https://stackoverflow.com/questions/16645083 
Perhaps some of that wording may be helpful.

--
nosy: +rhettinger

___
Python tracker 

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



[issue38636] "Alt + T" and "Alt + U" Broken in IDLE on Windows

2019-10-29 Thread Stephen Paul Chappell


New submission from Stephen Paul Chappell :

In the latest Python 3.8.0 installation when running IDLE on Windows, pressing 
"Alt + T" generates the following error:

Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Program Files\Python38\Lib\tkinter\__init__.py", line 1883, in 
__call__
return self.func(*args)
  File "C:\Program Files\Python38\Lib\idlelib\multicall.py", line 176, in 
handler
r = l[i](event)
TypeError: toggle_tabs_event() missing 1 required positional argument: 
'event'

Similarly, pressing "Alt + U" will generate a very similar error:

Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Program Files\Python38\Lib\tkinter\__init__.py", line 1883, in 
__call__
return self.func(*args)
  File "C:\Program Files\Python38\Lib\idlelib\multicall.py", line 176, in 
handler
r = l[i](event)
TypeError: change_indentwidth_event() missing 1 required positional 
argument: 'event'

--
assignee: terry.reedy
components: IDLE, Windows
messages: 355678
nosy: Zero, paul.moore, steve.dower, terry.reedy, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: "Alt + T" and "Alt + U" Broken in IDLE on Windows
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



[issue36702] test_dtrace failed

2019-10-29 Thread will rogers


will rogers  added the comment:

I also encountered this on Scientific Linux 7.4 (Linux 
3.10.0-693.11.6.el7.x86_64) while trying to build Python 3.8.0.

I think it is due to differences in versions of 'dtrace' on different platforms.
On my MacOS-X v10.14.6 (Mojave) system, the 'dtrace' command has a  -q (quiet 
the output) option.
On SL 7.4, it does not. The options are quite different.


This is output and versions from my test run:

./python  ./Tools/scripts/run_tests.py 
== CPython 3.8.0 (default, Oct 29 2019, 14:37:09) [GCC 4.8.5 20150623 (Red 
Hat 4.8.5-16)]
== Linux-3.10.0-693.11.6.el7.x86_64-x86_64-with-glibc2.17 little-endian
== cwd: /opt/Python-3.8.0/build/test_python_30482
== CPU count: 2
== encodings: locale=UTF-8, FS=utf-8

Below is an error from the test log that shows the 'q' option being rejected 
from 'dtrace' (linux'):

0:10:16 load avg: 1.79 Re-running test_dtrace in verbose mode
skipped "dtrace(1) failed: ('/usr/bin/dtrace', 'invalid option', 
'-q')\nUsage /usr/bin/dtrace [--help] [-h | -G] [-C [-I]] -s File.d [-o 
]"

Assuming 'dtrace' is run as a sub-process, the different versions could be 
producing very different results.

I attached a (clipped) version of my 'make test' output, it is essentially the 
same as sayno996's results.
There are also some error from 'test_nis" which can be ignoed for this issue.

I hope this helps.

--
nosy: +willrogers3
versions: +Python 3.8
Added file: https://bugs.python.org/file48687/make_test-clipped.txt

___
Python tracker 

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



[issue38635] Simplify decoding the ZIP64 extra field and make it tolerant to extra data

2019-10-29 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue38635] Simplify decoding the ZIP64 extra field and make it tolerant to extra data

2019-10-29 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

The decoding code can be much shorter and efficient.

Also, the Info-ZIP unzip utility is tolerant to extra bytes. We can be too.

--
components: Library (Lib)
messages: 355676
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: Simplify decoding the ZIP64 extra field and make it tolerant to extra 
data
type: enhancement
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



[issue38629] float is missing __ceil__() and __floor__(), required by numbers.Real

2019-10-29 Thread Mark Dickinson


Mark Dickinson  added the comment:

> If float.__ceil__ will be executed it will add significant overhead for 
> creating and executing the method object.

Yes, I'd definitely like to see timings; I think Victor already asked for those 
on the PR.

--

___
Python tracker 

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



[issue24686] zipfile is intolerant of extra bytes

2019-10-29 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Interesting, but all extra after the Extended Timestamp field is a UTF-8 
encoded text:

b"\n\x00 
\x00\x00\x00\x00\x00\x01\x00\x18\x00\x00\xeb\x93\x91'\xef\xbf\xbd\xef\xbf\xbd\x01\x00\xde\xa8\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\x01\x00\xde\xa8\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\x01"
 == "\n\x00 
\x00\x00\x00\x00\x00\x01\x00\x18\x00\x00\ub4d1'\ufffd\ufffd\x01\x00\u07a8\ufffd\ufffd\ufffd\x01\x00\u07a8\ufffd\ufffd\ufffd\x01".encode()

The chance that random binary data is a UTF-8 encoded text is small, so it 
looks like garbage text encoded with UTF-8 was appended to the extra.

It is definitely not Python issue.

--
resolution:  -> third party
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



[issue38629] float is missing __ceil__() and __floor__(), required by numbers.Real

2019-10-29 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Oh, you are right. I misunderstood the original issue and thought that the code 
first checks PyFloat_Check() or PyFloat_CheckExact().

If float.__ceil__ will be executed it will add significant overhead for 
creating and executing the method object.

--

___
Python tracker 

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



[issue38634] Symbol resolution conflict when embeding python in an application using libedit

2019-10-29 Thread Ned Deily


Ned Deily  added the comment:

This appears to be essentially a duplicate of Issue13631 which has long 
proposed full support of libedit.

--
assignee:  -> gregory.p.smith
nosy: +gregory.p.smith, ned.deily

___
Python tracker 

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



[issue13501] Make libedit support more generic; port readline / libedit to FreeBSD

2019-10-29 Thread serge-sans-paille


Change by serge-sans-paille :


--
pull_requests: +16513
pull_request: https://github.com/python/cpython/pull/16986

___
Python tracker 

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



[issue38627] Add copy() method to pathlib

2019-10-29 Thread Brett Cannon


Brett Cannon  added the comment:

And just to add Serhiy's logic, think of pathlib more as an equivalent to 
os.path than a be-all solution to anything path-related.

--
nosy: +brett.cannon

___
Python tracker 

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



[issue38629] float is missing __ceil__() and __floor__(), required by numbers.Real

2019-10-29 Thread Mark Dickinson


Mark Dickinson  added the comment:

> I have doubts about adding a C code which is never even executed.

My reading of the PR is that it *would* be executed: the math module first 
looks for the __floor__ special method, then falls back to using the libm floor 
if that doesn't exist. Am I missing something?

--

___
Python tracker 

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



[issue38598] IDLE: Disable F5, etc, in Shell and Output windows.

2019-10-29 Thread Tal Einat


Tal Einat  added the comment:

As a better design for a long-term fix, I suggest:

* Avoiding isinstance() checks by instead using a dedicated class attribute and 
checking that. (I've recently used this pattern for line numbers.)
* Instead of baling out inside the "check module" and "run" handlers, don't 
include the related items in the menus in the first place. (Make them 
conditional on the above-mentioned class attribute's value.)

--
nosy: +taleinat

___
Python tracker 

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



[issue38629] float is missing __ceil__() and __floor__(), required by numbers.Real

2019-10-29 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

If float.__ceil__ is only needed for typeshed, maybe add a special case for 
typeshed?

I have doubts about adding a C code which is never even executed.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue35459] Use PyDict_GetItemWithError() instead of PyDict_GetItem()

2019-10-29 Thread Raphaël M

Raphaël M  added the comment:

I stumbled upon this issue while reading Python 3.8 and this made me curious.

I've tried writing some Python code to reproduce this bug, but I'm unable to -- 
I should be missing something. Is there a simple snippet showing the issue? 


Also, the changelog states that "The CPython interpreter can swallow exceptions 
in some circumstances". Are there other documented cases of those circumstances?

--
nosy: +raphaelm

___
Python tracker 

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



[issue36666] threading.Thread should have way to catch an exception thrown within

2019-10-29 Thread Joel Croteau


Joel Croteau  added the comment:

I'm kind of in agreement with Mark on this, actually. I came across this 
problem when examining some threaded code that was clearly not working as 
intended, but was reporting success. Figuring out why that was was not easy. 
The code had been hastily ported to a multi-threaded version from an iterative 
version by my predecessor, and neither of us had enough familiarity with Python 
threads to realize what the problem was. The whole point of having exceptions 
is that it gives you a way of knowing when errors happen without having to add 
a bunch of extra error checking to your own code. It rather defeats the purpose 
if code can silently fail while still throwing exceptions, and we have to add 
extra code to handle special cases like this where they are ignored.

--

___
Python tracker 

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



[issue14196] Unhandled exceptions in pdb return value display

2019-10-29 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Batuhan, thanks for the nudge.  For the record ...

If __new__ were a normal instance method, then 'some_class.__new__()' would be 
a correct call, as 'some_class' would be passed to '__new__' as its first and 
perhaps only argument.  But " __new__() is a static method (special-cased so 
you need not declare it as such)".
https://docs.python.org/3/reference/datamodel.html#object.__new__
Its special-casing makes it easy to forget that its first argument, a class, 
must be passed explicitly.  Hence Xavier's comment.

In current 2.7.17 and 3.8 (for instance), with pdb left out of the picture, the 
missing cls argument results in
  TypeError: object.__new__(): not enough arguments

When I pdb.run('A()') new and step, it catches the error and refuses to advance.

> (3)__new__()
(Pdb) s
TypeError: object.__new__(): not enough arguments
> (3)__new__()

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
type:  -> behavior

___
Python tracker 

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



[issue36666] threading.Thread should have way to catch an exception thrown within

2019-10-29 Thread Mark Borgerding


Mark Borgerding  added the comment:

I'm not trying to disrespect anyone: not users nor certainly Python developers. 
 I have loved Python since I learned it in 2001.  I was merely trying to 
respond to what seemed like an automatic rejection of changing legacy behavior. 
 I certainly agree changes to default behavior should not be made lightly, but 
sometimes they *should* be made.

This may be such a case:
a) A user writing a thread function either consciously thinks about exceptions 
while they write function or they do not.  Sure, we should always do the 
former; just like we should always eat our veggies and get lots of exercise, 
but 
b) If they *do* think about exceptions, they will either
b.1) write exception handlers within that function, or
b.2) rely on default behavior that simply prints out the exception string to 
stderr and lets the thread quietly die.
c) If they did not explicitly think about exceptions while they wrote the 
function, they may have in the back of their mind the reasonable expectation 
that an exception will not be ignored.

Changing `join()` to propagate unhandled exceptions would admittedly break b.2 
code, but provides absolution for all sinners who have written case c.

This is what I meant by, "I suspect there is more code that will be fixed by 
such a change than broken."

I'll confess I only just now became aware of `threading.excepthook` added in 
python 3.8.  Does it change this problem?

--
Added file: https://bugs.python.org/file48686/ignored_thread_exc.py

___
Python tracker 

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



[issue38560] Disallow iterable argument unpacking after a keyword argument?

2019-10-29 Thread Guido van Rossum


Guido van Rossum  added the comment:

Well, as you point out, f(z=0, *(1, 2)) is legal, and the parser doesn't know 
what the names of the keyword arguments are. SO this cannot be changed.

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



[issue38613] Optimize some set operations in dictkeys object

2019-10-29 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Consider testing PyDict_CheckExact.

--
nosy: +rhettinger

___
Python tracker 

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



[issue36666] threading.Thread should have way to catch an exception thrown within

2019-10-29 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> I'd argue such code deserves to be broken

That argument falls flat with me and it doesn't show respect for our users.  
The proposal would be a major change to the "rules of the game" and would 
likely require discussion and buy-in on python-dev and perhaps a PEP.

Please heed Antoine's advice.  This is his area of expertise, and he has 
suggested a plausible way to go forward.

--
nosy: +rhettinger

___
Python tracker 

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



[issue38560] Disallow iterable argument unpacking after a keyword argument?

2019-10-29 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Changes to the grammar of the language need to be discussed on python-dev 
(especially ones that can break existing code and ones that change syntax that 
has worked for many years).  Arguably, this is something that should just go 
into a lint tool.

--
nosy: +gvanrossum, rhettinger

___
Python tracker 

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



[issue38620] Shell python-config --includes returns the same path twice

2019-10-29 Thread Matthias Klose


Matthias Klose  added the comment:

Some distros have two include directories in the path,

 /usr/include
 /usr/include/

The latter for architecture specific files, so on these distributions the 
python config file is installed there.  Then you'll need to have both include 
directories.  Unfortunately most third party only expect one, and because the 
config file is installed in a subdir, then fail to build.

So the solution is to provide a rather arch specific ugly wrapper file to get 
away with one include directory.

https://salsa.debian.org/cpython-team/python3/blob/master/debian/multiarch.h.in

Also done on other distros like
https://src.fedoraproject.org/rpms/gmp/blob/master/f/gmp.h

I still think the two directories should be emitted, maybe check in the script 
if they are different.

--

___
Python tracker 

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



[issue38620] Shell python-config --includes returns the same path twice

2019-10-29 Thread Miro Hrončok

Change by Miro Hrončok :


--
nosy: +hroncok

___
Python tracker 

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



[issue38560] Disallow iterable argument unpacking after a keyword argument?

2019-10-29 Thread Brandt Bucher

Brandt Bucher  added the comment:

I’ve thought about it and I’m +1 on DeprecationWarning in 3.9 and SyntaxError 
in 3.10.

Removing any type of legal function call is tricky, but this is such obscure, 
sneaky syntax that it’s likely an accident/bug if it does pop up (that’s how I 
discovered it). And every instance can be trivially refactored.

--
title: Allow iterable argument unpacking after a keyword argument? -> Disallow 
iterable argument unpacking after a keyword argument?

___
Python tracker 

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



[issue30548] typo in documentation for create_autospec

2019-10-29 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



[issue38634] Symbol resolution conflict when embeding python in an application using libedit

2019-10-29 Thread pmp-p


Change by pmp-p :


--
nosy: +pmpp

___
Python tracker 

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



[issue38621] Bad decoding of encoded-words in unstructured email headers

2019-10-29 Thread Fred Drake


Fred Drake  added the comment:

It turns out this was a problem in 3.7.4; Python 3.7.5 seems to have fixed this.

Sorry for the noise.

Guess it's time to update my application to use 3.7.5!

--
resolution:  -> fixed
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



[issue38634] Symbol resolution conflict when embeding python in an application using libedit

2019-10-29 Thread serge-sans-paille


Change by serge-sans-paille :


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

___
Python tracker 

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



[issue38634] Symbol resolution conflict when embeding python in an application using libedit

2019-10-29 Thread serge-sans-paille


New submission from serge-sans-paille :

See https://bugs.llvm.org/show_bug.cgi?id=43830, but basically the follwing 
code:

```
// a.c
#include 

int main() {
  Py_Initialize();
  PyRun_SimpleString("import readline; print(readline.__doc__)");
  return 0;
}
```

compiled like this:

```
% gcc a.c `./install/bin/python3-config --cflags --ldflags --libs` -lpython3.9
```

runs fine:

```
% ./a.out  
Importing this module enables command line editing using GNU readline.
```

However the following:

```
% gcc a.c `./install/bin/python3-config --cflags --ldflags --libs` -ledit 
-lpython3.9
```

compiles but segfaults at runtime.

--
messages: 355656
nosy: serge-sans-paille
priority: normal
severity: normal
status: open
title: Symbol resolution conflict when embeding python in an application using 
libedit
type: crash

___
Python tracker 

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



[issue38629] float is missing __ceil__() and __floor__(), required by numbers.Real

2019-10-29 Thread Batuhan


Change by Batuhan :


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

___
Python tracker 

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



[issue38633] shutil.copystat fails with PermissionError in WSL

2019-10-29 Thread Peter


New submission from Peter :

Using shutil.copystat (and therefore also shutil.copytree) in WSL on any 
directories from a mounted Windows drive (i.e. /mnt/c/...) raises an 
shutil.Error "[Errno 13] Permission denied". 

It seems to fail when copying the extended filesystem attribute 
"system.wsl_case_sensitive" using os.setxattr() here: 
https://github.com/python/cpython/blob/da6ce58dd5ac109485af45878fca6bfd265b43e9/Lib/shutil.py#L322

Note that this only happens when both src and dst are on the mounted drive. If 
only one is on the drive and the other is e.g. in the home directory 
/home/username/, it will not raise an error. 

Quick way to test: 

cd /mnt/c/ && mkdir test1 && mkdir test2 && python -c "import shutil; 
shutil.copystat('test1', 'test2')"

--
components: Library (Lib), Windows
messages: 355655
nosy: paul.moore, pspeter, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: shutil.copystat fails with PermissionError in WSL
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue38621] Bad decoding of encoded-words in unstructured email headers

2019-10-29 Thread Ned Deily


Change by Ned Deily :


___
Python tracker 

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



[issue38621] Bad decoding of encoded-words in unstructured email headers

2019-10-29 Thread Fred Drake


Fred Drake  added the comment:

This problem does not exist in Python 3.6 or Python 3.8; it appears to only 
exist in Python 3.7.

--
versions: +Python 3.7

___
Python tracker 

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



[issue35745] Add import statement in dataclass code snippet

2019-10-29 Thread Eric V. Smith


Eric V. Smith  added the comment:

Closed in favor of issue 36661 (which I realize was opened later, but has more 
discussion, so I'm using it going forward).

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

___
Python tracker 

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



[issue38632] setup.py sdist should honor SOURCE_DATE_EPOCH

2019-10-29 Thread Zack Weinberg


New submission from Zack Weinberg :

Reproducibility has so far been concerned primarily with binary packages, but 
it's also desirable for source tarballs to be reproducible starting from a 
version-control checkout.  This is particularly important for Python, where 
'setup.py sdist' can run arbitrary code and generated files (e.g. 
Cython-generated C) are often included in sdists.

As a small step toward this goal, please add support for the SOURCE_DATE_EPOCH 
environment variable to distutils.command.sdist.  The most natural way to 
implement this would be with an additional user option, perhaps called 
'timestamp_limit', which takes a date and time argument.  File modification 
timestamps in the generated tarball or zipfile will be adjusted to be no later 
than that time.  If 'timestamp_limit' is not set, it defaults to the value of 
os.environ['SOURCE_DATE_EPOCH'].

The specification for SOURCE_DATE_EPOCH may be found at 
https://reproducible-builds.org/specs/source-date-epoch/ .

--
components: Distutils
messages: 355652
nosy: dstufft, eric.araujo, zwol
priority: normal
severity: normal
status: open
title: setup.py sdist should honor SOURCE_DATE_EPOCH

___
Python tracker 

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



[issue38629] float is missing __ceil__() and __floor__(), required by numbers.Real

2019-10-29 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +mark.dickinson

___
Python tracker 

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



[issue38631] Replace Py_FatalError() with regular Python exceptions

2019-10-29 Thread STINNER Victor


New submission from STINNER Victor :

I replaced dozens of Py_FatalError() calls with better error reporting, but 
there are still many places calling Py_FatalError().

The problem of Py_FatalError() is when Python is embedded into an application: 
Python must not kill the whole process.

Well, even in the "regular" Python (/usr/bin/python3), Python should not exit 
immediately on an error.

For example, the readline module calls Py_FatalError() on memory allocation 
failure, whereas PyErr_NoMemory() could be used: PyErr_NoMemory() should work 
since it should not allocate memory.

--
components: Interpreter Core
messages: 355651
nosy: vstinner
priority: normal
severity: normal
status: open
title: Replace Py_FatalError() with regular Python exceptions
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



[issue36666] threading.Thread should have way to catch an exception thrown within

2019-10-29 Thread pmp-p


Change by pmp-p :


--
nosy: +pmpp

___
Python tracker 

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



[issue38629] float is missing __ceil__() and __floor__(), required by numbers.Real

2019-10-29 Thread Ran Benita


Ran Benita  added the comment:

You can take it - thanks!

--

___
Python tracker 

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



[issue36666] threading.Thread should have way to catch an exception thrown within

2019-10-29 Thread Mark Borgerding


Mark Borgerding  added the comment:

@pitrou  I don't necessarily agree that "current behavior can't be changed". 
One major selling point of exceptions is that they cannot be accidentally 
ignored.  The exception is how the current threading.Thread ignores them.

You are correct that changing Thread.join() so it propagates exceptions by 
default may break code that relies on the implicit behavior of a thread dying 
when the target/run method raises.  I'd argue such code deserves to be broken 
-- "explicit is better than implicit".

I suspect there is more code that will be fixed by such a change than broken.

--
nosy: +Mark Borgerding

___
Python tracker 

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



[issue38629] float is missing __ceil__() and __floor__(), required by numbers.Real

2019-10-29 Thread Batuhan


Batuhan  added the comment:

Ran, do you want to work on this or can i take it?

--
nosy: +BTaskaya

___
Python tracker 

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



[issue38630] subprocess.Popen.send_signal() should poll the process

2019-10-29 Thread STINNER Victor


STINNER Victor  added the comment:

I noticed this issue by reading subprocess code while working on bpo-38207 
("subprocess: Popen.kill() + Popen.communicate() is blocking until all 
processes using the pipe close the pipe") and bpo-38502 ("regrtest: use process 
groups").

--

___
Python tracker 

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



[issue38630] subprocess.Popen.send_signal() should poll the process

2019-10-29 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue38630] subprocess.Popen.send_signal() should poll the process

2019-10-29 Thread STINNER Victor


New submission from STINNER Victor :

subprocess.Popen.send_signal() doesn't check if the process exited since the 
poll() method has been called for the last time. If the process exit just 
before os.kill() is called, the signal can be sent to the wrong process if the 
process identified is recycled.

Attached PR simply calls poll() once to reduce the time window when this race 
condition can occur, but it doesn't fully kill the race condition.

--

See also the new "pidfd" API which only landed very recently in the Linux 
kernel to prevent this issue:

* https://lwn.net/Articles/773459/
  "Toward race-free process signaling" (this articles describes this issue)
* https://lwn.net/Articles/789023/ 
  "New system calls: pidfd_open() and close_range()"
* 
https://kernel-recipes.org/en/2019/talks/pidfds-process-file-descriptors-on-linux/
  "pidfds: Process file descriptors on Linux" by Chrisitan Brauner

Illumos, OpenBSD, NetBSD and FreeBSD have similar concepts.

I don't propose to use pidfd here, but it's just to highlight that it's a real 
issue and that kernels are evolving to provide more reliable solutions against 
the kill(pid, sig) race condition ;-)

--
components: Library (Lib)
messages: 355645
nosy: vstinner
priority: normal
severity: normal
status: open
title: subprocess.Popen.send_signal() should poll the process
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



[issue23692] Undocumented feature prevents re module from finding certain matches

2019-10-29 Thread Lewis Gaul


Lewis Gaul  added the comment:

Thanks for the explanation Matthew, I'll take a further look at some point in 
the coming weeks.

--

___
Python tracker 

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



[issue26669] time.localtime(float("NaN")) does not raise a ValueError on all platforms

2019-10-29 Thread STINNER Victor


STINNER Victor  added the comment:

Python 2 users have this bug since 2010, I think that it's fine to not fix it. 
Python 2 support ends at the end of the year. I close the issue.

The issue has been fixed in Python 3.6 and newer.

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



[issue37838] typing.get_type_hints not working with forward-declaration and decorated functions

2019-10-29 Thread Benjamin Edwards


Benjamin Edwards  added the comment:

Thanks Netzeband,

Will get on this.

Ben

--

___
Python tracker 

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



[issue38629] float is missing __ceil__() and __floor__(), required by numbers.Real

2019-10-29 Thread Ran Benita


New submission from Ran Benita :

The numbers.Real ABC requires the __ceil__ and __floor__ methods 
(https://github.com/python/cpython/blob/v3.8.0/Lib/numbers.py#L178-L186), 
however, the float type does not have them.

In regular Python, this is not a problem, because math.ceil() and math.floor() 
special-case float and work on it directly, and numbers.Real is implemented on 
float by explicitly registering it (so it's not checked that all required 
methods are implemented).

Where it becomes a (minor) problem is in typeshed, where the type checker 
*does* check that all abstract methods are implemented. So, because float is 
missing these two, typeshed cannot have float implement numbers.Real.

Refs: https://github.com/python/typeshed/issues/3195

--
components: Interpreter Core, Library (Lib)
messages: 355642
nosy: bluetech
priority: normal
severity: normal
status: open
title: float is missing __ceil__() and __floor__(), required by numbers.Real
type: behavior

___
Python tracker 

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



[issue36971] Add subsections in C API "Common Object Structures" page

2019-10-29 Thread Batuhan


Batuhan  added the comment:

PR 13446 is merged, anything else is needed or can this issue be closed?

--
nosy: +BTaskaya

___
Python tracker 

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



[issue30533] missing feature in inspect module: getmembers_static

2019-10-29 Thread Batuhan


Change by Batuhan :


--
nosy: +BTaskaya
versions: +Python 3.9 -Python 3.8

___
Python tracker 

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



[issue32081] ipaddress should support fast IP lookups

2019-10-29 Thread Batuhan


Change by Batuhan :


--
nosy: +BTaskaya, pmoody

___
Python tracker 

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



[issue26669] time.localtime(float("NaN")) does not raise a ValueError on all platforms

2019-10-29 Thread Batuhan


Batuhan  added the comment:

Victor's PR 11507 is closed, what actions are going to be taken next? Close the 
issue as Mariatta said?

--
nosy: +BTaskaya

___
Python tracker 

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



[issue38608] Undocumented behavior that IsolatedAsyncioTestCase would enable event loop debug mode

2019-10-29 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Well, if the reported line is invalid it should be fixed

--

___
Python tracker 

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



[issue38608] Undocumented behavior that IsolatedAsyncioTestCase would enable event loop debug mode

2019-10-29 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
components: +asyncio
nosy: +yselivanov

___
Python tracker 

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



[issue38316] docs: Code object's "co_stacksize" field is described with mistake

2019-10-29 Thread Batuhan


Change by Batuhan :


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

___
Python tracker 

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



[issue21142] Daily/weekly ABI scan?

2019-10-29 Thread Batuhan


Batuhan  added the comment:

Tools/c-globals moved under Tools/c-analyzer

--
nosy: +BTaskaya

___
Python tracker 

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



[issue19510] lib2to3.fixes.fix_import gets confused if implicit relative imports and absolute imports are on the same line

2019-10-29 Thread Batuhan

Batuhan  added the comment:

> It’s still a bug though :)

It gives a warning about this though
 RefactoringTool: ### In file test/t.py ###
 RefactoringTool: Line 1: absolute and local imports together

If it still counts as a bug, let me know and i'll try to prepare a patch.

--
nosy: +BTaskaya

___
Python tracker 

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



[issue37330] open(): remove 'U' mode, deprecated since Python 3.3

2019-10-29 Thread STINNER Victor


STINNER Victor  added the comment:

> should we backport a documentation change for this? (the deprecatedremoved 
> says 4.0 currently)

Done. Thanks for the reminder.

--

___
Python tracker 

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



[issue37330] open(): remove 'U' mode, deprecated since Python 3.3

2019-10-29 Thread miss-islington


miss-islington  added the comment:


New changeset 4cb08b6c0ae6989d169dd48c2b24087941f6d0b0 by Miss Skeleton (bot) 
in branch '3.7':
bpo-37330: open(): "U" mode is removed in Python 3.9 (GH-16972)
https://github.com/python/cpython/commit/4cb08b6c0ae6989d169dd48c2b24087941f6d0b0


--
nosy: +miss-islington

___
Python tracker 

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



[issue14196] Unhandled exceptions in pdb return value display

2019-10-29 Thread Batuhan


Batuhan  added the comment:

Can't reproducible in py3 (3.8), IMHO can be closed.

--
nosy: +BTaskaya

___
Python tracker 

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



[issue37330] open(): remove 'U' mode, deprecated since Python 3.3

2019-10-29 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16508
pull_request: https://github.com/python/cpython/pull/16982

___
Python tracker 

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



[issue37330] open(): remove 'U' mode, deprecated since Python 3.3

2019-10-29 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 1d2862a323ae1387e306942253b1e487018e2b7f by Victor Stinner in 
branch '3.8':
bpo-37330: open(): "U" mode is removed in Python 3.9 (GH-16972)
https://github.com/python/cpython/commit/1d2862a323ae1387e306942253b1e487018e2b7f


--

___
Python tracker 

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



[issue38628] Issue with ctypes in AIX

2019-10-29 Thread Ayappan


New submission from Ayappan :

There seems to be a behavioral issue with ctypes in AIX. 
The specific symptom is that passing structures containing arrays to a C 
function by value appears to be broken.
Consider the below program.,

#!/usr/bin/env python3

from ctypes import *

libc = CDLL('libc.a(shr_64.o)')


class MemchrArgsHack(Structure):
_fields_ = [("s", c_char_p), ("c", c_ulong), ("n", c_ulong)]


memchr_args_hack = MemchrArgsHack()
memchr_args_hack.s = b"abcdef"
memchr_args_hack.c = ord('d')
memchr_args_hack.n = 7


class MemchrArgsHack2(Structure):
_fields_ = [("s", c_char_p), ("c_n", c_ulong * 2)]


memchr_args_hack2 = MemchrArgsHack2()
memchr_args_hack2.s = b"abcdef"
memchr_args_hack2.c_n[0] = ord('d')
memchr_args_hack2.c_n[1] = 7

print(
CFUNCTYPE(c_char_p, c_char_p, c_uint, c_ulong,
  c_void_p)(('memchr', libc))(b"abcdef", c_uint(ord('d')),
  c_ulong(7), None))
print(
CFUNCTYPE(c_char_p, MemchrArgsHack,
  c_void_p)(('memchr', libc))(memchr_args_hack, None))
print(
CFUNCTYPE(c_char_p, MemchrArgsHack2,
  c_void_p)(('memchr', libc))(memchr_args_hack2, None))

This one uses memchr from the C library and passing it structures that would 
map to the registers that correspond to the arguments of memchr. This works for 
the first structure type in the reproducer; however, using the second structure 
type (which should be treated the same way) does not work.

In the failing case, the last register that should be used for the structure is 
not populated from the structure. The reproducer passes an extra argument so 
that the register is instead populated from that argument for the failing case 
(instead of working because the register still contains the correct value from 
a previous call).

The output should be the same for all three calls, but we get:
b'def'
b'def'
None

The last line is None, because memchr got 0 (the None passed on the call) for 
its length argument.

--
components: ctypes
messages: 355632
nosy: Ayappan
priority: normal
severity: normal
status: open
title: Issue with ctypes in AIX
type: behavior
versions: Python 3.7

___
Python tracker 

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



[issue37523] zipfile: Raise ValueError for i/o operations on closed zipfile.ZipExtFile

2019-10-29 Thread Daniel Hillier


Daniel Hillier  added the comment:

Good point. Thanks for the advice. I've updated it to use timeit. Does that 
give a better indication?

import zipfile

test_zip = "time_test.zip"
test_name = "test_name.txt"

# with zipfile.ZipFile(test_zip, "w") as zf:
# zf.writestr(test_name, "Hi there! " * 300)

def test():
with zipfile.ZipFile(test_zip) as zf:
for i in range(10):
zf.read(test_name)


if __name__ == "__main__":
import timeit
print(timeit.repeat("test()", setup="from __main__ import test", number=1, 
repeat=10))


On my machine (running a usual workload) the best of 10 was:

master:
3.812s

check closed:
3.874s

But I think my machine had a quite a bit of variance between runs.

--

___
Python tracker 

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



[issue36993] zipfile: tuple IndexError on extract

2019-10-29 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Thank you for your contribution Daniel.

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



[issue31026] test_dbm fails when run directly

2019-10-29 Thread Larry Hastings


Larry Hastings  added the comment:


New changeset d7b336fe5d54f73c758802df426e06e8a674bd63 by Larry Hastings 
(Serhiy Storchaka) in branch '3.5':
[3.5] bpo-31026: Fix test_dbm if dbm.ndbm is build with Berkeley DB. (GH-6632)
https://github.com/python/cpython/commit/d7b336fe5d54f73c758802df426e06e8a674bd63


--

___
Python tracker 

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



[issue28029] Replace and empty strings

2019-10-29 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Note that no tests were affected by this change.

--

___
Python tracker 

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



[issue28029] Replace and empty strings

2019-10-29 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

There are expected some relations between str methods. For example,

s.replace(a, b, n) == s.replace(a, b)   if n >= s.count(a)
len(s.replace(a, b, n)) == len(s) + (len(b)-len(a)) * n   if 0 <= n <= 
s.count(a)
len(s.replace(a, b, n)) == len(s) + (len(b)-len(a)) * s.count(a)   if n >= 
s.count(a)

Inconsistency between "".replace("", s, n) and "".replace("", s) is just a bug, 
and it should be fixed in the most consistent way. There are precedences, the 
behavior of replace() already was changed 3 times in the past. I think that 
chances to break some code are tiny, we just fix inconsistency why can puzzle 
users.

--

___
Python tracker 

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



[issue36993] zipfile: tuple IndexError on extract

2019-10-29 Thread miss-islington


miss-islington  added the comment:


New changeset 3801b2699eb9441ca31c6ec8fa956fc0fe755ef7 by Miss Skeleton (bot) 
in branch '3.8':
bpo-36993: Improve error reporting for zipfiles with bad zip64 extra data. 
(GH-14656)
https://github.com/python/cpython/commit/3801b2699eb9441ca31c6ec8fa956fc0fe755ef7


--

___
Python tracker 

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



[issue36993] zipfile: tuple IndexError on extract

2019-10-29 Thread miss-islington


miss-islington  added the comment:


New changeset f7d50f8f997fbfce1556991a3700826536871fe7 by Miss Skeleton (bot) 
in branch '3.7':
bpo-36993: Improve error reporting for zipfiles with bad zip64 extra data. 
(GH-14656)
https://github.com/python/cpython/commit/f7d50f8f997fbfce1556991a3700826536871fe7


--
nosy: +miss-islington

___
Python tracker 

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



[issue28029] Replace and empty strings

2019-10-29 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +16507
pull_request: https://github.com/python/cpython/pull/16981

___
Python tracker 

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



[issue38541] Performance degradation of attribute accesses in Python 3.7.4

2019-10-29 Thread ttrd


ttrd  added the comment:

I just ran the test with Python 3.7.5: As expected, I got the same results as 
in Python 3.7.4.

Nevertheless, thanks for the response. So we will stay with Python 3.7.3 for 
now and switch to Python 3.8 as soon as possible.

--

___
Python tracker 

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



[issue36993] zipfile: tuple IndexError on extract

2019-10-29 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16505
pull_request: https://github.com/python/cpython/pull/16979

___
Python tracker 

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



[issue36993] zipfile: tuple IndexError on extract

2019-10-29 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16506
pull_request: https://github.com/python/cpython/pull/16980

___
Python tracker 

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



[issue36993] zipfile: tuple IndexError on extract

2019-10-29 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset da6ce58dd5ac109485af45878fca6bfd265b43e9 by Serhiy Storchaka 
(Daniel Hillier) in branch 'master':
bpo-36993: Improve error reporting for zipfiles with bad zip64 extra data. 
(GH-14656)
https://github.com/python/cpython/commit/da6ce58dd5ac109485af45878fca6bfd265b43e9


--

___
Python tracker 

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



[issue38336] Remove the __set__ method restriction on data descriptors for attribute lookup precedence

2019-10-29 Thread Raymond Hettinger

Raymond Hettinger  added the comment:


New changeset 4c155f738dc2e70ccb574f5169ad89c01753c6f7 by Raymond Hettinger 
(Géry Ogam) in branch 'master':
bpo-38336: Remove the __set__ method restriction on data descriptors for 
attribute lookup precedence (GH-16520)
https://github.com/python/cpython/commit/4c155f738dc2e70ccb574f5169ad89c01753c6f7


--

___
Python tracker 

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



[issue38336] Remove the __set__ method restriction on data descriptors for attribute lookup precedence

2019-10-29 Thread Raymond Hettinger


Change by Raymond Hettinger :


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



[issue37523] zipfile: Raise ValueError for i/o operations on closed zipfile.ZipExtFile

2019-10-29 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Thank you Daniel. But profiling is not good for benchmarking, it adds too much 
overhead. It can help to find narrow places, but for measuring effect of 
optimization you need to measure the raw time on non-debug build.

Semantically your changes are correct. I just want to know whether this adds a 
significant overhead. If it is, we should consider some kind of optimizations. 
It does not matter for Python implementation of BytesIO because in normal we 
use the C implementation.

--

___
Python tracker 

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



[issue38627] Add copy() method to pathlib

2019-10-29 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Since shutil.copy() accepts path-like object, I do not think there is a need to 
add the copy method to Path.

As for additional limitation, it looks arbitrary and application specific. You 
can easy implement a simple helper function as you just demonstrated. And you 
can easily modify it if your needs change (for example if you decide to not 
copy links). Not every three lines of code should be added as a function to the 
stdlib.

--
nosy: +serhiy.storchaka
resolution:  -> rejected
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



[issue38613] Optimize some set operations in dictkeys object

2019-10-29 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

But what if a dict subclass overrides __iter__? You can get different result if 
set(d) != set(d.keys()).

--

___
Python tracker 

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



[issue38613] Optimize some set operations in dictkeys object

2019-10-29 Thread Inada Naoki


Inada Naoki  added the comment:

> How does it work with dict subclasses?

PySet_New(iterable) uses fast path only when `PyDict_CheckExact(iterable)` is 
true.

So there is no change for dict subclasses.

--

___
Python tracker 

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



  1   2   >