[issue39871] math.copysign raises SystemError with non-float x and custom y

2020-03-05 Thread Mark Dickinson


Mark Dickinson  added the comment:

@David: do you have any interest in creating a PR?

--

___
Python tracker 

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



[issue39871] math.copysign raises SystemError with non-float x and custom y

2020-03-05 Thread Mark Dickinson


Mark Dickinson  added the comment:

Nice find. This affects not just copysign, but all of the math module functions 
that use FUNC2 under the hood. (I think that's just "remainder", "atan2" and 
"copysign".)

--

___
Python tracker 

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



[issue39871] math.copysign raises SystemError with non-float x and custom y

2020-03-05 Thread Mark Dickinson


Change by Mark Dickinson :


--
nosy: +mark.dickinson

___
Python tracker 

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



[issue39865] getattr silences an unrelated AttributeError

2020-03-05 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
nosy: +rhettinger

___
Python tracker 

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



[issue39867] randrange(N) for N's in same dyadic blocs have excessive correlations when sharing identical seeds

2020-03-05 Thread jfbu


jfbu  added the comment:

"bug" is a strong word, which I did never employ myself, apart from using this 
channel of report. I rather think of a (non-documented) "deficiency", but I 
expect the consensus will again be that I am expressing a "raw expression". 
However reading more than once that "the correlations are indeed unsurprising" 
it is my turn to see there a raw expression. The correlations are unsurprising 
*only* if one looks at the source code and understand how a (to a very high 
degree) uniform distribution on a power of 2 range is reduced to distribution 
on the smaller range (keeping the extremely high uniformity). Thus, sorry, the 
correlations are to the contrary *very surprising* to the end user who has no 
knowledge of the internals.

Donald Knuth for example many decades ago in his work on MetaPost used a RNG 
which is a kind a primitive ancestor (in the family of those commented upon in 
AOCP) of the much more sophisticated one used nowadays by Python. He used the 
rescaling with rounding method to go from power of 2 range to non power of 2 
range. That method induces some non-uniformity and if I understand (without 
having checked) it was the one from Python < 3.2. At some point Python changed 
its way to another way, to cure non-uniformity (and other artefacts of the 
simple minded rescaling method). But there are other ways to reduce the 
non-uniformity to negligible levels which are not the choice made currently in 
Python code. (which for people not having _randbelow_with_getrandbits before 
their eyes is simply to draw a random integer with at most the number of bits 
of the limit N until one is found at most equal to N).

--

___
Python tracker 

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



[issue39852] IDLE: Goto should remove selection and update the status bar

2020-03-05 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I am expanding this issue to include the part of #27115 that the PR will  fix. 
(I will also change the scope of the latter).

--
stage: patch review -> needs patch
title: IDLE: Goto should remove any selection -> IDLE: Goto should remove 
selection and update the status bar

___
Python tracker 

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



[issue39702] PEP 614: Relaxing Grammar Restrictions On Decorators

2020-03-05 Thread Brandt Bucher


Change by Brandt Bucher :


--
pull_requests: +18158
pull_request: https://github.com/python/cpython/pull/18802

___
Python tracker 

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



[issue39852] IDLE: Goto should remove any selection

2020-03-05 Thread Terry J. Reedy


Change by Terry J. Reedy :


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

___
Python tracker 

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



[issue39872] Remove unused args from two functions in Python/symtable.c

2020-03-05 Thread Andy Lester


Change by Andy Lester :


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

___
Python tracker 

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



[issue39868] Stale Python Language Reference docs (no walrus).

2020-03-05 Thread Brandt Bucher


Brandt Bucher  added the comment:

Thanks for offering to help, Shankar! For this change, you can look at the 
other sections of the Doc/reference/expressions.rst file for an idea of what 
we're looking for. I think a few sentences and maybe a small code snippet 
should probably be fine.

The devguide has all of the information that you need to get started. 
Specifically, you'll want to look at:

- https://devguide.python.org/docquality/
- https://devguide.python.org/documenting/
- https://devguide.python.org/pullrequest/

Also, you should sign the CLA *as soon as possible* 
(https://www.python.org/psf/contrib/contrib-form/)!

Once you've made a PR, please request a review from me so I can make sure it 
moves along quickly. Let me know if you have any questions... I know it can be 
really tricky at first!

--

___
Python tracker 

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



[issue39871] math.copysign raises SystemError with non-float x and custom y

2020-03-05 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
keywords: +easy (C)
stage:  -> needs patch
versions: +Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue39872] Remove unused args from two functions in Python/symtable.c

2020-03-05 Thread Andy Lester


Andy Lester  added the comment:

Two functions. It's only two functions.

--
title: Remove unused args from four functions in Python/symtable.c -> Remove 
unused args from two functions in Python/symtable.c

___
Python tracker 

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



[issue39852] IDLE: Goto should remove any selection

2020-03-05 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

selection_clear only partially clears a selection.  That it does something is 
proven by selection_clear.py.  It disables selection_get.  But run the file in 
IDLE and when it finishes, click the tk window, select a line, click Shell, and 
manually repeat the last 3 lines.  selection_get is disabled again, but upon 
clicking the title bar of the tk window (to not affect selection in the 
window), the selection is still highlighted.  Further experiments showed that 
the insertion-deletion bug of this issue remains when using selection_own and 
selection_clear in IDLE.

The alternative of simulating a click on the moved insert cursor is harder by 
works, at least on Windows.  This also triggers a status-bar update -- see 
#27115.

--
Added file: https://bugs.python.org/file48957/selection_clear.py

___
Python tracker 

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



[issue39872] Remove unused args from four functions in Python/symtable.c

2020-03-05 Thread Andy Lester


New submission from Andy Lester :

These four functions have unused arguments that can be removed:

symtable_exit_block -> void *ast

symtable_visit_annotations -> stmt_ty s

symtable_exit_block -> void *ast

symtable_visit_annotations -> stmt_ty s

PR is forthcoming.

--
components: Interpreter Core
messages: 363486
nosy: petdance
priority: normal
severity: normal
status: open
title: Remove unused args from four functions in Python/symtable.c

___
Python tracker 

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



[issue39573] Make PyObject an opaque structure in the limited C API

2020-03-05 Thread Andy Lester


Change by Andy Lester :


--
pull_requests: +18155
pull_request: https://github.com/python/cpython/pull/18799

___
Python tracker 

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



[issue39573] Make PyObject an opaque structure in the limited C API

2020-03-05 Thread Andy Lester


Change by Andy Lester :


--
pull_requests: +18154
pull_request: https://github.com/python/cpython/pull/18798

___
Python tracker 

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



[issue39863] Add trimend option to readline() and readlines()

2020-03-05 Thread Inada Naoki


Inada Naoki  added the comment:

> It would be better to name it keepends and set it True by default.

.readline() returns only one line.  Should we use plural form for consistency?

> It is also not good for file-like classes which do not inherit IOBase, but 
> implement a part of methods. You can't start to use new arguments in your 
> code if you accepted arbitrary file-like objects that have methods read() and 
> readline().

OK.  It should be added to only concrete types.

--

___
Python tracker 

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



[issue39868] Stale Python Language Reference docs (no walrus).

2020-03-05 Thread miss-islington


miss-islington  added the comment:


New changeset 0c717709c1b19b6f146b56db5f10bab3f09c by Miss Islington (bot) 
in branch '3.8':
bpo-39868: Update Language Reference for PEP 572. (GH-18793)
https://github.com/python/cpython/commit/0c717709c1b19b6f146b56db5f10bab3f09c


--

___
Python tracker 

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



[issue39868] Stale Python Language Reference docs (no walrus).

2020-03-05 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset 8bae21962bab2fac7630982abd73676b89930902 by Brandt Bucher in 
branch 'master':
bpo-39868: Update Language Reference for PEP 572. (#18793)
https://github.com/python/cpython/commit/8bae21962bab2fac7630982abd73676b89930902


--
nosy: +gvanrossum

___
Python tracker 

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



[issue39868] Stale Python Language Reference docs (no walrus).

2020-03-05 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 5.0 -> 6.0
pull_requests: +18153
pull_request: https://github.com/python/cpython/pull/18797

___
Python tracker 

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



[issue39867] randrange(N) for N's in same dyadic blocs have excessive correlations when sharing identical seeds

2020-03-05 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I concur with Tim and Mark.  This isn't a bug.  The randomization occurs at the 
getrandbits() level.  The downstream functions, such as randbelow and 
randrange, have no responsibility to create additional dispersion; instead, 
their role is to map the upstream scattering to the desired target 
distributions.

The correlations found by the OP are indeed unsurprising.  They disappear 
entirely when using two difference seeds or by making successive selections 
from a single stream.

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



[issue39866] get_type_hints raises inconsistent TypeError

2020-03-05 Thread Guido van Rossum


Guido van Rossum  added the comment:

It should definitely not return {} for objects without __annotations__ 
attributes -- get_type_hints(42) should raise TypeError.

One could argue that get_type_hints(Bar()) incorrectly returns a dict, but we 
want to allow for some duck typing here, and, honestly, I don't see this is a 
big problem. The error message tries to convey the most likely cause of the 
problem (and it does so nicely for things like get_type_hints(42)).

I think we needn't fix this.

--
resolution:  -> wont fix
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue39859] set_herror should not throw away constness of hstrerror

2020-03-05 Thread miss-islington


miss-islington  added the comment:


New changeset e63117a84ef11083be86db7afb2ac2789491ca09 by Andy Lester in branch 
'master':
closes bpo-39859: Do not downcast result of hstrerror (GH-18790)
https://github.com/python/cpython/commit/e63117a84ef11083be86db7afb2ac2789491ca09


--
nosy: +miss-islington
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



[issue39870] sys_displayhook_unencodable takes an unnecessary PyThreadState * argument

2020-03-05 Thread Benjamin Peterson


Benjamin Peterson  added the comment:


New changeset da4d656e951b00580d135ae6345656ecedf9d8d4 by Andy Lester in branch 
'master':
closes bpo-39870: Remove unused arg from sys_displayhook_unencodable. (GH-18796)
https://github.com/python/cpython/commit/da4d656e951b00580d135ae6345656ecedf9d8d4


--
nosy: +benjamin.peterson
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



[issue39861] French doc __futur__: Bad URL

2020-03-05 Thread Matheus Vieira Portela


Matheus Vieira Portela  added the comment:

I just opened a PR for that: https://github.com/python/python-docs-fr/pull/1176

--
nosy: +matheus.v.portela

___
Python tracker 

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



[issue39871] math.copysign raises SystemError with non-float x and custom y

2020-03-05 Thread David Vo


New submission from David Vo :

If math.copysign(x, y) is passed an x that cannot be converted to a float and a 
y that implements __float__() in Python, math.copysign() will raise a 
SystemError from the TypeError resulting from the attempted float conversion of 
x.

math.copysign() should probably return immediately if converting the first 
argument to a float raises an error.

Example:

>>> import math
>>> from fractions import Fraction
>>> float(Fraction(-1, 1))  # this is needed to avoid an AttributeError?
-1.0
>>> math.copysign((-1) ** 0.5, Fraction(-1, 1))
TypeError: can't convert complex to float

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.8/numbers.py", line 291, in __float__
return self.numerator / self.denominator
SystemError: PyEval_EvalFrameEx returned a result with an error set

--
components: Extension Modules
messages: 363477
nosy: auscompgeek
priority: normal
severity: normal
status: open
title: math.copysign raises SystemError with non-float x and custom y
type: behavior

___
Python tracker 

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



[issue39866] get_type_hints raises inconsistent TypeError

2020-03-05 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +gvanrossum, levkivskyi

___
Python tracker 

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



[issue27115] IDLE goto should always update status bar line & column

2020-03-05 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I changed the title to reflect the intended user-visible behavior, which was 
always the real issue.  The original title proposed a solution that would not 
work.  The revised title gave an alternate solution that should not work.   

The discrepancy between clicking [Ok] and and pressing  arises because 
pressing Enter in the query box leaks  to the text, which 
happens to trigger a status bar update.  I regard this somewhat accidental 
side-effect to be a bug to be fixed.  Changing the text and status bar are the 
responsibility of the event handler.

The line number query box should just return a positive int or None, without 
side-effect.  So we should make sure that Query boxes do not leak key events 
and create a subclass to get a positive int.  But such a replacement is 
somewhat independent of triggering <>. 

A related issue is that goto does not clear selections. #39844.  I may fix that 
and this with one PR.

--
title: IDLE: replace uses of tkinter simpledialog with query.Query -> IDLE goto 
should always update status bar line & column

___
Python tracker 

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



[issue39870] sys_displayhook_unencodable takes an unnecessary PyThreadState * argument

2020-03-05 Thread Andy Lester


Change by Andy Lester :


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

___
Python tracker 

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



[issue39870] sys_displayhook_unencodable takes an unnecessary PyThreadState * argument

2020-03-05 Thread Andy Lester


Change by Andy Lester :


--
components: +Interpreter Core

___
Python tracker 

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



[issue39870] sys_displayhook_unencodable takes an unnecessary PyThreadState * argument

2020-03-05 Thread Andy Lester


New submission from Andy Lester :

sys_displayhook_unencodable in Python/sysmodule.c doesn't need its first 
argument.  Remove it.

--
messages: 363475
nosy: petdance
priority: normal
severity: normal
status: open
title: sys_displayhook_unencodable takes an unnecessary PyThreadState * argument

___
Python tracker 

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



[issue39864] IndexError gives wrong axis info

2020-03-05 Thread Ningyi Du


Ningyi Du  added the comment:

I believe it's a bug. The axis 0 is misleading.  However, it is a problem
for numpy developers. Thank you for your time.

On Thu, Mar 5, 2020, 10:42 AM Peter Otten  wrote:

>
> Peter Otten <__pete...@web.de> added the comment:
>
> This is not a bug (and if it were you would have to report to numpy, not
> cpython).
>
> Consider:
>
> >>> import numpy
> >>> a = numpy.zeros((2,2,2))
> >>> a[0,2]
> Traceback (most recent call last):
>   File "", line 1, in 
> IndexError: index 2 is out of bounds for axis 1 with size 2
>
> This is probably the message you expect. However, if you write
> >>> a[0][2]
> Traceback (most recent call last):
>   File "", line 1, in 
> IndexError: index 2 is out of bounds for axis 0 with size 2
>
> you split the operation into two steps, and the second axis of a is
> effectively the first axis of a[0].
>
> --
> nosy: +peter.otten -steven.daprano
>
> ___
> Python tracker 
> 
> ___
>

--
title: IndexError  gives wrong axis info -> IndexError gives wrong axis info

___
Python tracker 

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



[issue39868] Stale Python Language Reference docs (no walrus).

2020-03-05 Thread SHANKAR JHA


SHANKAR JHA  added the comment:

This is my first contribution to Python. This is why I am looking for some 
guidance, just point me to some resource, and then I will look into it 
thoroughly.

I am reading this https://www.python.org/dev/peps/pep-0572/ for better 
understanding.

--

___
Python tracker 

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



[issue39689] test_struct failure on s390x Fedora Clang buildbot

2020-03-05 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

FYI - I updated the ubsan buildbot to clang 9 so this one shows up in there now:

/var/lib/buildbot/workers/clang-ubsan/3.x.gps-clang-ubsan.clang-ubsan/build/Modules/_struct.c:487:28:
 runtime error: load of value 116, which is not a valid value for type '_Bool'
Objects/memoryobject.c:1702:15: runtime error: load of value 116, which is not 
a valid value for type '_Bool'
Objects/memoryobject.c:2704:15: runtime error: load of value 116, which is not 
a valid value for type '_Bool'
Objects/memoryobject.c:2704:15: runtime error: load of value 116, which is not 
a valid value for type '_Bool'

--

___
Python tracker 

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



[issue39867] randrange(N) for N's in same dyadic blocs have excessive correlations when sharing identical seeds

2020-03-05 Thread Tim Peters


Tim Peters  added the comment:

This is where you're not getting traction:

"A randrange() function should a priori not be so strongly tied to the binary 
base."

That's a raw assertion.  _Why_ shouldn't it be?  "Because I keep saying so" 
isn't changing minds ;-)

I understand you're looking at exact equality of t-tuples.  I wasn't in my 
example:  I was looking at the individual values, one pair at a time.  The 
extreme correlation is dead obvious by eyeball either way, despite that the 
only test you seem to have in mind (exact equality of t-tuples) is blind to it. 
 Why is that test so important?  Why does it not matter that, e.g., number of 
inversions, number of runs, distribution of run-lengths (etc) remain highly 
correlated regardless?

Nobody else has had a problem with this, and it remains unclear why you do:  
what's your objection to Mark's suggestions (use different seeds, or _don't_ 
reset the seed)?  That's the obvious approach:  use the facilities in 
straightforward ways.

In any case, we can't/won't make changes on a whim.  As far as possible, we 
strive to keep results bit-for-bit identical across releases for people who 
save/set seeds, hoping to get reproducible results.  Changing the results from 
any random module function requires strong justification.

So far, I don't see that here.

--

___
Python tracker 

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



[issue39682] pathlib.Path objects can be used as context managers

2020-03-05 Thread Isaac Muse


Isaac Muse  added the comment:

Wrong thread sorry

--

___
Python tracker 

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



[issue39856] glob : some 'unix style' glob items are not supported

2020-03-05 Thread Isaac Muse


Isaac Muse  added the comment:

Brace expansion does not currently exist in Python's glob. You'd have to use a 
third party module to expand the braces and then run glob on each returned 
pattern, or use a third party module that implements a glob that does it for 
you.

Shameless plug:

Brace expansion: https://github.com/facelessuser/bracex

Glob that does it for you (when the feature is enabled): 
https://github.com/facelessuser/wcmatch

Now whether Python should integrate such behavior by default is another 
question.

--
nosy: +Isaac Muse

___
Python tracker 

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



[issue39682] pathlib.Path objects can be used as context managers

2020-03-05 Thread Isaac Muse


Isaac Muse  added the comment:

Brace expansion does not currently exist in Python's glob. You'd have to use a 
third party module to expand the braces and then run glob on each returned 
pattern, or use a third party module that implements a glob that does it for 
you.

Shameless plug:

Brace expansion: https://github.com/facelessuser/bracex

Glob that does it for you (when the feature is enabled): 
https://github.com/facelessuser/wcmatch

Now whether Python should integrate such behavior by default is another 
question.

--
nosy: +Isaac Muse

___
Python tracker 

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



[issue39868] Stale Python Language Reference docs (no walrus).

2020-03-05 Thread Brandt Bucher


Brandt Bucher  added the comment:

Of course. After my PR is merged, you can make another PR that replaces the ".. 
TODO: BPO-39868" line with a description of how assignment expressions work. 
Likely much of the language can be borrowed from the PEP.

Let me know if you need help with any of the steps. Have you written RST / made 
a CPython PR on GitHub before?

--

___
Python tracker 

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



[issue39837] Remove Azure Pipelines from GitHub PRs

2020-03-05 Thread Brett Cannon


Brett Cannon  added the comment:

I've turned off the required checks for GH Actions and flipped Azure Pipelines 
back on.

And to answer Victor's question, yes, you can make things conditional at the 
workflow, job, and job step level. I don't know what would happen if the check 
was moved from workflow to job level.

--

___
Python tracker 

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



[issue39868] Stale Python Language Reference docs (no walrus).

2020-03-05 Thread SHANKAR JHA


SHANKAR JHA  added the comment:

Thank you for that!!!

Can you please provide some pointers to what exactly I have to do?

--

___
Python tracker 

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



[issue39868] Stale Python Language Reference docs (no walrus).

2020-03-05 Thread Brandt Bucher


Change by Brandt Bucher :


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

___
Python tracker 

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



[issue39868] Stale Python Language Reference docs (no walrus).

2020-03-05 Thread Brandt Bucher


Brandt Bucher  added the comment:

Sorry, I hadn't seen your comment... :(

I've already finished the grammar specification bit, but not the prose 
description of how assignment expressions work, etc.

How about I leave that empty in my PR and you can actually do the documentation 
part afterward that's merged? Cool? I'd be happy to review it.

--

___
Python tracker 

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



[issue39869] Improve Instance Objects tutorial documentation

2020-03-05 Thread Mariatta


New submission from Mariatta :

In https://docs.python.org/3.9/tutorial/classes.html#instance-objects, it says:

> There are two kinds of valid attribute names, data attributes and methods.

Replace the comma with a colon

> There are two kinds of valid attribute names: data attributes and methods.


Reported in docs mailing list: 
https://mail.python.org/archives/list/d...@python.org/thread/BWXLZM4OLWF5XVBI4S2WK3LFUIEBI6M6/

--
assignee: docs@python
components: Documentation
keywords: newcomer friendly
messages: 363463
nosy: Mariatta, docs@python
priority: normal
severity: normal
stage: needs patch
status: open
title: Improve Instance Objects tutorial documentation
versions: Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue39868] Stale Python Language Reference docs (no walrus).

2020-03-05 Thread SHANKAR JHA


SHANKAR JHA  added the comment:

Can I take this issue?

--
nosy: +shankarj67

___
Python tracker 

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



[issue39867] randrange(N) for N's in same dyadic blocs have excessive correlations when sharing identical seeds

2020-03-05 Thread jfbu


jfbu  added the comment:

@tim.peters yes, a uniform random variable rescaled to two nearby scales N and 
M will display strong correlations. The CPython randrange() exhibits however 
orders of magnitude higher such correlations, but only in relation to a common 
bitlength. A randrange() function should a priori not be so strongly tied to 
the binary base.

The example you show would not be counted as a hit by my test for the 
randomseed 12.

>>> s = 0
>>> for t in range(10):
... random.seed(t)
... x = [round(random.random() * 100) for i in range(10)]
... random.seed(t)
... y = [round(random.random() * 101) for i in range(10)]
... if x == y:
... s += 1
... 
>>> s
94
>>> s = 0
>>> for t in range(10):
... random.seed(t)
... x = [random.randrange(100) for i in range(10)]
... random.seed(t)
... y = [random.randrange(101) for i in range(10)]
... if x == y:
... s += 1
... 
>>> s
90432

--

___
Python tracker 

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



[issue39837] Remove Azure Pipelines from GitHub PRs

2020-03-05 Thread Steve Dower


Steve Dower  added the comment:

Adding a screenshot here so I can point people at it.

Let's not rush into complicating the build steps yet - AP is basically fine. We 
should switch back the required checks (@Brett?)

If anything, let's add a "condition: false" to the macOS build to disable it 
and rely on the non-required GH check for now.

--
Added file: https://bugs.python.org/file48956/Annotation 2020-03-05 223851.png

___
Python tracker 

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



[issue39867] randrange(N) for N's in same dyadic blocs have excessive correlations when sharing identical seeds

2020-03-05 Thread Tim Peters


Tim Peters  added the comment:

Sorry, I don't see "a problem" here either.  Rounding instead can change the 
precise nature of the correlations if you insist on starting from the same 
seed, but it hardly seems a real improvement; e.g.,

>>> random.seed(12)
>>> [round(random.random() * 100) for i in range(10)]
[47, 66, 67, 14, 1, 37, 27, 81, 69, 60]
>>> random.seed(12)
>>> [round(random.random() * 101) for i in range(10)]
[48, 66, 67, 14, 1, 38, 28, 82, 70, 61]

That is, while there are fewer identical values, the correlation is 
nevertheless obvious and extreme.  Not only not a bug, it's not even surprising 
;-)

--
nosy: +tim.peters

___
Python tracker 

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



[issue39837] Remove Azure Pipelines from GitHub PRs

2020-03-05 Thread STINNER Victor


STINNER Victor  added the comment:

Instead of not running the job, is it technically possible to modify the jobs 
to do nothing for docs only changes?

.travis.yml works like that:

before_install:
  - set -e
  - |
  # Check short-circuit conditions
  if [[ "${TESTING}" != "docs" && "${TESTING}" != "doctest" ]]
  then
if [[ "$TRAVIS_PULL_REQUEST" == "false" ]]
then
  echo "Not a PR, doing full build."
else
  # Pull requests are slightly complicated because $TRAVIS_COMMIT_RANGE
  # may include more changes than desired if the history is convoluted.
  # Instead, explicitly fetch the base branch and compare against the
  # merge-base commit.
  git fetch -q origin +refs/heads/$TRAVIS_BRANCH
  changes=$(git diff --name-only HEAD $(git merge-base HEAD FETCH_HEAD))
  echo "Files changed:"
  echo "$changes"
  if ! echo "$changes" | grep -qvE '(\.rst$)|(^Doc)|(^Misc)'
  then
echo "Only docs were updated, stopping build process."
exit
  fi
fi
  fi

--

___
Python tracker 

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



[issue39852] IDLE: Goto should remove any selection

2020-03-05 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

This is much clearer.  To expand on what I said before, inserting *anything*, 
such as by hitting a key, replaces a selection.  I verified that this is normal 
behavior, at least on Windows, with Notepad, Notepad++, and this Firefox entry 
box I am typing in.  So either of your steps 6 or 7 delete the still selected 
line, after the goto.  (And so a click is needed before 6 to stop the 
deletion.)  I see the continued selection as the problem.  Both Notepad and 
Notepad++ unselect any selection upon goto, the same as if one moved the cursor 
by clicking instead of goto.

I will try adding text.selection_clear() to the goto code.

--
stage:  -> needs patch
title: IDLE: Copy/Paste behaves like Cut/Paste -> IDLE: Goto should remove any 
selection
versions: +Python 3.7, Python 3.9

___
Python tracker 

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



[issue39868] Stale Python Language Reference docs (no walrus).

2020-03-05 Thread Brandt Bucher


New submission from Brandt Bucher :

It looks like https://docs.python.org/3/reference/expressions.html and 
https://docs.python.org/3/reference/compound_stmts.html were never updated for 
named expressions.

Because this change has to be backported, it's sort of a blocker for my PEP 614 
doc updates in issue 39702, which need to use the missing node in 3.9 only (I'd 
rather have this get a clean backport now than a messy one later)!

Is somebody more familiar with PEP 572 willing to take this? Should be pretty 
straightforward.

Pinging Emily since it looks like you've done some grammar/doc work for this in 
the past.

--
assignee: docs@python
components: Documentation
keywords: easy
messages: 363456
nosy: brandtbucher, docs@python, emilyemorehouse
priority: normal
severity: normal
status: open
title: Stale Python Language Reference docs (no walrus).
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



[issue39837] Remove Azure Pipelines from GitHub PRs

2020-03-05 Thread Steve Dower


Steve Dower  added the comment:

Looks like it isn't fixed... https://github.com/python/cpython/pull/18774

--

___
Python tracker 

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



[issue39867] randrange(N) for N's in same dyadic blocs have excessive correlations when sharing identical seeds

2020-03-05 Thread jfbu


jfbu  added the comment:

Yes indeed the source code of _randbelow_with_getrandbits generates this 
effect. And I understand the puzzlement about my test file setting the same 
random seed and then complaining about correlations. But there is some 
non-uniformity which is enormous between what happens for say n=99 and m=127 
versus n=99 and m=128.

Now that I looked at the actual source code, I have in other programming 
contexts available manners of reducing from a power of 2 to an arbitrary range 
which should not show this artefact.  I will need to translate it into Python 
and may submit a PR for evaluation after having tested.

My test file illustrates that if randrange() proceeded from a pseudo-random 
variable emulating the uniform distribution in (0,1) and rescaled and rounded 
to an integer range, correlations between distinct ranges would be of a 
completely different nature than what the CPython method leads to.

--

___
Python tracker 

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



[issue39845] Argparse on Python 3.7.1 (Windows) appends double quotes to string if it ends with backward slash

2020-03-05 Thread paul j3


paul j3  added the comment:

Then this isn't an argparse issue.  Probably not even a Python one.  The 
windows shell (which one? cmd.exe?  power? some batch) is making the 
substitution. 

I see lots of discussion about Windows use of backslash, both as directory 
separator and escape.  None seems to exactly apply.

For your application the use of a custom 'type' function might well be 
appropriate, but it's not something we want to add to argparse.  It's a user 
specific patch.

--

___
Python tracker 

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



[issue39867] randrange(N) for N's in same dyadic blocs have excessive correlations when sharing identical seeds

2020-03-05 Thread Mark Dickinson


Mark Dickinson  added the comment:

These results are hardly surprising, given the algorithms used. But why would 
you consider this a problem?

If you want your randrange(n) and randrange(m) results to be independent, don't 
generate them from the exact same random source, starting with the same seed. 
Use different seeds, or generate one set of results followed by the other 
without resetting the seed in between.

--
nosy: +mark.dickinson, rhettinger

___
Python tracker 

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



[issue39867] randrange(N) for N's in same dyadic blocs have excessive correlations when sharing identical seeds

2020-03-05 Thread jfbu


New submission from jfbu :

We generate quadruples of random integers using randrange(n) and randrange(m) 
and count how many times the quadruples are identical, using the same random 
seed. Of course for nearby n and m (the real life example was with n==95 and 
m==97) we do expect matches. But we found orders of magnitude more than was 
expected.

The attached file demonstrates this by comparison with random()*n (with 
rounding) as alternative method to generate the random integers (we are aware 
this gives less uniformity for a given range, but these effects are completely 
negligible in comparison to the effect we test). For the latter the probability 
of matches is non-vanishing but orders of magnitude smaller than using 
randrange(n).

Here is an excerpt of our testing result. Each trial uses a random seed 
(selected via randrange(1)). Then 4 random integers in two given ranges 
are generated and compared. A hit is when all 4 match.

- with randrange():

n = 99, m = 124, 4135 hits among 1 trials
n = 99, m = 125, 3804 hits among 1 trials
n = 99, m = 126, 3803 hits among 1 trials
n = 99, m = 127, 3892 hits among 1 trials
n = 99, m = 128, 0 hits among 1 trials
n = 99, m = 129, 0 hits among 1 trials
n = 99, m = 130, 0 hits among 1 trials
n = 99, m = 131, 0 hits among 1 trials

- with random():

n = 99, m = 124, 0 hits among 1 trials
n = 99, m = 125, 0 hits among 1 trials
n = 99, m = 126, 0 hits among 1 trials
n = 99, m = 127, 0 hits among 1 trials
n = 99, m = 128, 0 hits among 1 trials
n = 99, m = 129, 0 hits among 1 trials
n = 99, m = 130, 0 hits among 1 trials
n = 99, m = 131, 0 hits among 1 trials

The test file has some hard-coded random seeds for reproductibility.

Although I did only limited testing it is flagrant there is completely abnormal 
correlation between randrange(n) and randrange(m) when the two integers have 
the same length in base 2.

Tested with 3.6 and 3.8.

--
files: testrandrange.py
messages: 363451
nosy: jfbu
priority: normal
severity: normal
status: open
title: randrange(N) for N's in same dyadic blocs have excessive correlations 
when sharing identical seeds
versions: Python 3.8
Added file: https://bugs.python.org/file48955/testrandrange.py

___
Python tracker 

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



[issue39866] get_type_hints raises inconsistent TypeError

2020-03-05 Thread Joey

New submission from Joey :

If you pass in an instance of an object without type annotations, you get an 
error that states "XXX is not a module, class, method, or function." This 
correctly describes the situation

 typing.get_type_hints(object())
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/local/lib/python3.8/typing.py", line 1252, in get_type_hints
raise TypeError('{!r} is not a module, class, method, '
TypeError:  is not a module, class, method, or 
function.

However, if you pass in an instance of a class that _does_ have type 
annotations...

>class Bar:
...foo: int
>typing.get_type_hints(Bar())
{'foo': }

You don't get an error even though the message of the first exception would 
suggest you do.

Fix should be pretty easy, either just have the get_type_hints always return a 
dictionary, and return an empty dictionary if the type of the object has no 
__annotations__ defined (my preferred solution), or actually check to see if 
the object is an instance of `_allowed_types` before checking whether the 
object has annotations.

--
components: Library (Lib)
messages: 363450
nosy: j.tran4418
priority: normal
severity: normal
status: open
title: get_type_hints raises inconsistent TypeError
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



[issue39865] getattr silences an unrelated AttributeError

2020-03-05 Thread pasenor


New submission from pasenor :

if a class has a descriptor and a defined __getattr__ method, and an 
AttributeError (unrelated to the descriptor lookup) is raised inside the 
descriptor, it will be silenced:

class A:
@property
def myprop(self):
print("property called")
a = 1
a.foo  # <-- AttributeError that should not be silenced

def __getattr__(self, attr_name):
print("__getattr__ called")

a = A()
a.myprop


In this example myprop() is called, the error silenced, then __getattr__() is 
called.
This can lead to rather subtle bugs. Probably an explicit AttributeError should 
be raised instead.

--
messages: 363449
nosy: pasenor
priority: normal
severity: normal
status: open
title: getattr silences an unrelated AttributeError
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue34305] inspect.getsourcefile and inspect.getcomments do not work with decorated functions

2020-03-05 Thread Ryan McCampbell


Ryan McCampbell  added the comment:

This seems like a pretty straightforward fix. What's holding it up?

--
nosy: +rmccampbell7

___
Python tracker 

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



[issue39837] Remove Azure Pipelines from GitHub PRs

2020-03-05 Thread Brett Cannon


Brett Cannon  added the comment:

It was an old issue that if required checks didn't run it would block, but 
hopefully it's fixed. :)

I have gone ahead and removed the Azure Pipelines requirement from 3.7, 3.8, 
and master and flipped on the check requirements for the ones I listed.

--

___
Python tracker 

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



[issue39808] pathlib: reword docs for stat()

2020-03-05 Thread miss-islington


miss-islington  added the comment:


New changeset 7b39c474e4ce7057a9e16b06d40261ff563b1e9d by Miss Islington (bot) 
in branch '3.8':
[3.8] bpo-39808: Improve docs for pathlib.Path.stat() (GH-18719) (GH-18783)
https://github.com/python/cpython/commit/7b39c474e4ce7057a9e16b06d40261ff563b1e9d


--

___
Python tracker 

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



[issue39808] pathlib: reword docs for stat()

2020-03-05 Thread Brett Cannon


Brett Cannon  added the comment:

Thanks, swgmma!

--

___
Python tracker 

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



[issue39863] Add trimend option to readline() and readlines()

2020-03-05 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It would be better to name it keepends and set it True by default.

I wanted this feature. The problem is that it is not just concrete 
implementation, it is an interface. Adding new parameters for IOBase methods 
will break all IOBase subclasses. And there are IOBase subclasses in 
third-party code.

It is also not good for file-like classes which do not inherit IOBase, but 
implement a part of methods. You can't start to use new arguments in your code 
if you accepted arbitrary file-like objects that have methods read() and 
readline().

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue31652] make install fails: no module _ctypes

2020-03-05 Thread Alexander Stohr


Alexander Stohr  added the comment:

Ubuntu 16.04 in a very bare naked setup.
Similar/same problem profile by message and other lines in the log.
Installed libffi6 and libffi-dev => worked.

Not sure if both were needed (or interdependent, 2nd to 1st).

--
nosy: +Alexander Stohr

___
Python tracker 

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



[issue39862] Why are the union relationships not implemented by default for ≤ and ≥?

2020-03-05 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

See https://www.python.org/dev/peps/pep-0207/

--
nosy: +rhettinger

___
Python tracker 

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



[issue35537] use os.posix_spawn in subprocess

2020-03-05 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +18150
pull_request: https://github.com/python/cpython/pull/18792

___
Python tracker 

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



[issue1294959] Problems with /usr/lib64 builds.

2020-03-05 Thread STINNER Victor


STINNER Victor  added the comment:

See also bpo-24871: "freeze.py doesn't work on x86_64 Linux out of the box".

> On 64-bit Linux freeze.py uses lib instead of lib64 when constructing
> path to Makefile etc. Using sysconfig fixes this issue.

--

___
Python tracker 

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



[issue29753] Ctypes Packing Bitfields Incorrectly - Linux

2020-03-05 Thread Sam Price


Sam Price  added the comment:

I ran into this bug on mac and submitted a duplicate issue of 39858


If you add the check *pfield_size != *pbitofs it fixes this bug.

#ifndef MS_WIN32
} else if (bitsize /* this is a bitfield request */
&& *pfield_size /* we have a bitfield open */
&& *pfield_size != *pbitofs /* Current field has been filled, start new 
one */
&& dict->size * 8 >= *pfield_size
&& (*pbitofs + bitsize) <= dict->size * 8) {
/* expand bit field */
fieldtype = EXPAND_BITFIELD;
#endif


However this would not fix the results where you expand a bitfield around 3 
bytes.
clang produces the 3 bytes if you try and expand around.
#include 
#include 
typedef struct testA{
uint8_t a0 : 7;
uint8_t a1 : 7;
uint8_t a2 : 7;
uint8_t a3 : 3;
}  __attribute__((packed)) testA;

int main(){
printf("%d\n", sizeof(testA)); /* Prints out 3 */
return 0;
}
python prints out a size of 4.

--
nosy: +thesamprice

___
Python tracker 

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



[issue39852] IDLE: Copy/Paste behaves like Cut/Paste

2020-03-05 Thread Dave Liptack


Dave Liptack  added the comment:

OS: Windows 10 Pro
Version: 1909
OS Build: 18363.657

Python 2.7.17 and 3.8.1 were installed from https://www.python.org/downloads/ 
using the Windows x86-64 executable installer (3.8.1) and Windows x86-64 MSI 
installer (2.7.17)

Both line numbers and code context are not present

To reproduce:
1) Position cursor at the start of a line of text
2) Type Shift+down arrow (to select line of text)
3) Type Ctrl+c
4) Type Alt+g (IDLE) or Ctrl+g (Notepad, Notepad++)
5) Enter line number (for example below line number = 2)
6) Type Enter
7) Type Ctrl+v


Example initial text:
# This is line 1

# additional line
# This is a line I wish to duplicate
# another additional line


Resulting text in IDLE:
# This is line 1
# This is a line I wish to duplicate

# additional line
# another additional line


Resulting text in Notepad and Notepad++:
# This is line 1
# This is a line I wish to duplicate

# additional line
# This is a line I wish to duplicate
# another additional line


My workaround in IDLE is to add a step between #6 and #7 above, where I mouse 
click at the desired paste location

--

___
Python tracker 

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



[issue39858] bitfield layout wrong in ctypes

2020-03-05 Thread Sam Price


Sam Price  added the comment:

Does not happen on windows.

Error is in cfield.c

```
#ifndef MS_WIN32
} else if (bitsize /* this is a bitfield request */
&& *pfield_size /* we have a bitfield open */
&& dict->size * 8 >= *pfield_size
&& (*pbitofs + bitsize) <= dict->size * 8) {
/* expand bit field */
fieldtype = EXPAND_BITFIELD;
#endif
```

Specifically dict->size * 8 >= *pfield_size
if *bitofs == *pfield_size then the current field is filled, and expanding the 
bitfield should not be done.

Consider adding this *pfield_size != *bitofs
#ifndef MS_WIN32
} else if (bitsize /* this is a bitfield request */
&& *pfield_size /* we have a bitfield open */
&& *pfield_size != *pbitofs /* Current field has been filled, start new 
one */
&& dict->size * 8 >= *pfield_size
&& (*pbitofs + bitsize) <= dict->size * 8) {
/* expand bit field */
fieldtype = EXPAND_BITFIELD;
#endif

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

___
Python tracker 

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



[issue39864] IndexError gives wrong axis info

2020-03-05 Thread Peter Otten


Peter Otten <__pete...@web.de> added the comment:

This is not a bug (and if it were you would have to report to numpy, not 
cpython).

Consider:

>>> import numpy
>>> a = numpy.zeros((2,2,2))
>>> a[0,2]
Traceback (most recent call last):
  File "", line 1, in 
IndexError: index 2 is out of bounds for axis 1 with size 2

This is probably the message you expect. However, if you write
>>> a[0][2]
Traceback (most recent call last):
  File "", line 1, in 
IndexError: index 2 is out of bounds for axis 0 with size 2

you split the operation into two steps, and the second axis of a is effectively 
the first axis of a[0].

--
nosy: +peter.otten -steven.daprano

___
Python tracker 

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



[issue39864] IndexError gives wrong axis info

2020-03-05 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

This is a numpy issue, you will need to report it to the numpy developers. But 
first you need to check that it really is a bug. What makes you think it is a 
bug? In your example, index 3 looks out of bounds to me. Remember that indexes 
start at 0, not 1.

In any case, this has nothing to do with us, numpy is an independent project, 
you will need to report it to them.

--
nosy: +steven.daprano
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



[issue39864] IndexError gives wrong axis info

2020-03-05 Thread Ningyi Du


Ningyi Du  added the comment:

This is a simple test:

test=np.zeros((2,3,4))
print(test[1][3][1])

IndexErrorTraceback (most recent call last)
 in 
  1 test=np.zeros((2,3,4))
> 2 print(test[1][3][1])

IndexError: index 3 is out of bounds for axis 0 with size 3

--
nosy:  -xtreak

___
Python tracker 

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



[issue39864] IndexError gives wrong axis info

2020-03-05 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Please include a sample script to reproduce the program along with a 
description of why you think it's an error in CPython. This seems to be a 
custom exception raised by a library.

--
nosy: +xtreak

___
Python tracker 

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



[issue39864] IndexError gives wrong axis info

2020-03-05 Thread Ningyi Du


New submission from Ningyi Du :

IndexError: index 11 is out of bounds for axis 0 with size 11

The actual error is not with axis 0, but axis 3.

error message:
168 if iJ>=9:
169 print(iE,iE0,iEtemp,iJ,li,lf,mlf+lf)
--> 170 SS[iEtemp][iJ][li][lf][mlf+lf]= 
FF(jf,mf,lf,mlf,ji,mi,li,J)*SJ[iCh][jCh]
171 
172 sumSJ1 += np.abs(SJ0[iCh][jCh])**2

IndexError: index 11 is out of bounds for axis 0 with size 11

--
messages: 363433
nosy: ningyidu
priority: normal
severity: normal
status: open
title: IndexError  gives wrong axis info

___
Python tracker 

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



[issue8840] truncate() semantics changed in 3.1.2

2020-03-05 Thread A.M. Kuchling


Change by A.M. Kuchling :


--
resolution:  -> wont fix
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



[issue39855] test.test_subprocess.POSIXProcessTestCase.test_user fails in the limited build environment

2020-03-05 Thread STINNER Victor


STINNER Victor  added the comment:

Python 3.8 is not affected. I close the issue.

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



[issue39855] test.test_subprocess.POSIXProcessTestCase.test_user fails in the limited build environment

2020-03-05 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset f7b5d419bf871d9cc898982c7b6b4c043f7d5e9d by Victor Stinner in 
branch 'master':
bpo-39855: Fix test_subprocess if nobody user doesn't exist (GH-18781)
https://github.com/python/cpython/commit/f7b5d419bf871d9cc898982c7b6b4c043f7d5e9d


--

___
Python tracker 

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



[issue39863] Add trimend option to readline() and readlines()

2020-03-05 Thread Inada Naoki


New submission from Inada Naoki :

str.splitlines() has `keepends` option.
Like that, `IOBase.readline([trimend=False])` and 
`IOBase.readlines([trimends=False])` would be useful.

--
components: IO
messages: 363430
nosy: inada.naoki
priority: normal
severity: normal
status: open
title: Add trimend option to readline() and readlines()
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



[issue33347] zlibmodule undefined reference

2020-03-05 Thread Martin Ni


Martin Ni  added the comment:

Hello sir! I got exactly same issue when compile some ipk in Openwrt. Would 
tell how to add "-lz" to python-config? I am not so familiar with Python 
coding. Thanks!

--
nosy: +Martin Ni

___
Python tracker 

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



[issue39860] configparser - no support for cascading defaults (as defined by MySQL)

2020-03-05 Thread Ben Griffin


Ben Griffin  added the comment:

Having looked at the code, I believe that it is best NOT to interfere with the 
'default_section' value of the class, as it is used as a proxy to _defaults, 
whereas the section parameter of get() is easily extended.

The actual changes are all to the method _unify_values, and it is trivial to 
extend that method to allow for multiple dictionaries to be passed to _ChainMap.

This is what I did in PR-18791

--
type:  -> enhancement

___
Python tracker 

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



[issue39860] configparser - no support for cascading defaults (as defined by MySQL)

2020-03-05 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
nosy: +python-dev
nosy_count: 1.0 -> 2.0
pull_requests: +18148
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/18791

___
Python tracker 

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



[issue39862] Why are the union relationships not implemented by default for ≤ and ≥?

2020-03-05 Thread Géry

New submission from Géry :

Mathematically, the [binary 
relation](https://en.wikipedia.org/wiki/Binary_relation) ≤ is the 
[union](https://en.wikipedia.org/wiki/Binary_relation#Union) of the binary 
relations < and =, while the binary relation ≥ is the union of the binary 
relations > and =. So is there a reason why Python does not implement `__le__` 
in terms of `__lt__` and `__eq__` by default, and `__ge__` in terms of `__gt__` 
and `__eq__` by default?

The default implementation would be like this (but probably in C for 
performance, like `__ne__`):

```python
def __le__(self, other):
result_1 = self.__lt__(other)
result_2 = self.__eq__(other)
if result_1 is not NotImplemented and result_2 is not NotImplemented:
return result_1 or result_2
return NotImplemented

def __ge__(self, other):
result_1 = self.__gt__(other)
result_2 = self.__eq__(other)
if result_1 is not NotImplemented and result_2 is not NotImplemented:
return result_1 or result_2
return NotImplemented
```

This would save users from implementing these two methods all the time.

Here is the relevant paragraph in the [Python 
documentation](https://docs.python.org/3/reference/datamodel.html#object.__lt__)
 (emphasis mine):

> By default, `__ne__()` delegates to `__eq__()` and inverts the result
> unless it is `NotImplemented`. There are no other implied
> relationships among the comparison operators, **for example, the truth
> of `(xhttps://en.wikipedia.org/wiki/Binary_relation#Properties) (also called 
connex orders) and therefore not implemented by default: < is the 
[complement](https://en.wikipedia.org/wiki/Binary_relation#Complement) of ≥, 
and > is the complement of ≤. These complementary relationships can be easily 
implemented by users when they are valid with the 
[`functools.total_ordering`](https://docs.python.org/3/library/functools.html#functools.total_ordering)
 class decorator provided by the Python standard library.

--
components: Interpreter Core
messages: 363426
nosy: maggyero
priority: normal
severity: normal
status: open
title: Why are the union relationships not implemented by default for ≤ and ≥?
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



[issue39837] Remove Azure Pipelines from GitHub PRs

2020-03-05 Thread Steve Dower


Steve Dower  added the comment:

Are you sure the required check isn't just for failures? Surely GitHub is 
smarter than requiring checks that it can tell aren't required (as it's their 
logic to include/exclude, not ours).

If they're not, I now have many internal contacts there, so we can probably get 
it fixed :)

--

___
Python tracker 

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



[issue27743] Python 2 has a wrong artificial limit on the amount of memory that can be allocated in ctypes

2020-03-05 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It was fixed in issue16865.

--
nosy: +serhiy.storchaka
resolution:  -> out of date
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



[issue39845] Argparse on Python 3.7.1 (Windows) appends double quotes to string if it ends with backward slash

2020-03-05 Thread Ion Cebotari


Ion Cebotari  added the comment:

Yes, the problem seems to be with sys.argv.:

Windows output:
python .\main.py -d Z:\tmp\test\DJI\ 'C:\unu doi\'
sys.argv:
['.\\CamCardOrganizer.py', '-d', 'Z:\\tmp\\test\\DJI\\', 'C:\\unu doi"']
args namespace:
Namespace(capturedatefmt='%y.%m.%d', capturetimefmt_full='%y.%m.%d_%H-%M-%S', ca
pturetimefmt_short='%y.%m.%d_%H', dest_dir='C:\\unu doi"', dry_run=True, output_
file='stdout', processes=2, src_dir='Z:\\tmp\\test\\DJI\\', tl_interval_threshol
d=30, tl_numimages_threshold=75, verbose=False, version=None)

Linux output:
python main.py --verbose ~/tmp/test/DJI/ /tmp/123
sys.argv:
['CamCardOrganizer.py', '--verbose', '/home/ion/tmp/test/DJI/', '/tmp/123']
args namespace:
Namespace(capturedatefmt='%y.%m.%d', capturetimefmt_full='%y.%m.%d_%H-%M-%S', 
capturetimefmt_short='%y.%m.%d_%H', dest_dir='/tmp/123', dry_run=False, 
output_file='stdout', processes=2, src_dir='/home/ion/tmp/test/DJI/', 
tl_interval_threshold=30, tl_numimages_threshold=75, verbose=True, version=None)

--

___
Python tracker 

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



[issue39861] French doc __futur__: Bad URL

2020-03-05 Thread Dorian

New submission from Dorian :

Hello,

In the French page:

https://docs.python.org/fr/3/library/__future__.html

There is a bad URL in the table at the end of the page:

division/2.2.0a2/3.0/PEP 328 : Changement de l'opérateur de division

It's supposed to be PEP 238, not 328.

The URL is https://www.python.org/dev/peps/pep-0328

It's supposed to be https://www.python.org/dev/peps/pep-0238

Should be easy to fix.

Keep the good work.

Regards,

Dorian

--
assignee: docs@python
components: 2to3 (2.x to 3.x conversion tool), Documentation
messages: 363422
nosy: Narann, docs@python
priority: normal
severity: normal
status: open
title: French doc __futur__: Bad URL

___
Python tracker 

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



[issue39860] configparser - no support for cascading defaults (as defined by MySQL)

2020-03-05 Thread Ben Griffin


New submission from Ben Griffin :

While there is now support for a single default group, mysql documentation is 
clear that there is a cascade of groups for option settings, normally starting 
with [client], and including version numbers..

This allows generic settings to be overridden by specific settings, and it's an 
important feature when building an architecture around a mysql/mariadb 
environment.

A typical configuration chain may look like this.

[client] -> [mysql] -> [mysql-5.6] -> [pymysql] -> [my_custom_app]

Currently, the implementation of configparser only allows the programmer to 
define the default group (typically [client]) and then the group to read from 
[my_custom_app].

In terms of a proposed approach to the library, I suggest two changes (both 
backwards compatible).
(1) Extend the 'default_section' initializer such that it supports both a 
string (current implementation) and an iterable (ordered from specialised to 
general).

(2) Likewise extend the 'section' parameter of get() such that it supports both 
a string (current implementation) and an iterable (ordered from specialised to 
general), as above.

Mysql's own docs are as follows.

https://dev.mysql.com/doc/refman/8.0/en/option-files.html#option-file-syntax

"List more general option groups first and more specific groups later. For 
example, a [client] group is more general because it is read by all client 
programs, whereas a [mysqldump] group is read only by mysqldump. Options 
specified later override options specified earlier, so putting the option 
groups in the order [client], [mysqldump] enables mysqldump-specific options to 
override [client] options."

--
components: Library (Lib)
messages: 363421
nosy: Ben Griffin
priority: normal
severity: normal
status: open
title: configparser - no support for cascading defaults (as defined by MySQL)
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



[issue39844] IDLE 3.8.2 on MacOS 10.15.3 Launches to Black Windows

2020-03-05 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

The black one from 2.42 shows that the disfunction in your system is not in 
tkinter app and is likely upstream from that (the relationship between tk and 
mac).

--

___
Python tracker 

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