[issue37925] --embed not included in python3.8-config usage/--help

2019-08-22 Thread Miro Hrončok

New submission from Miro Hrončok :

Based on changes in 
https://docs.python.org/3.8/whatsnew/3.8.html#debug-build-uses-the-same-abi-as-release-build
 I think that the usage string of python3.8-config should also contain --embed.

Actual output:

$ python3.8-config
Usage: /usr/bin/python3.8-x86_64-config 
--prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--help|--abiflags|--configdir

Expected output:

$ python3.8-config
Usage: /usr/bin/python3.8-x86_64-config 
--prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--embed|--extension-suffix|--help|--abiflags|--configdir

--
components: Extension Modules
messages: 350250
nosy: hroncok, vstinner
priority: normal
severity: normal
status: open
title: --embed not included in python3.8-config usage/--help
versions: 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



[issue37924] Embedding Python in Another Application: Compiling under Unix misses the --embed flag

2019-08-22 Thread Miro Hrončok

New submission from Miro Hrončok :

Based on changes in 
https://docs.python.org/3.8/whatsnew/3.8.html#debug-build-uses-the-same-abi-as-release-build
 I belive we should document the python3.8-config --embed flag in 
https://docs.python.org/3.8/extending/embedding.html#compiling-and-linking-under-unix-like-systems

--
assignee: docs@python
components: Documentation
messages: 350249
nosy: docs@python, hroncok, vstinner
priority: normal
severity: normal
status: open
title: Embedding Python in Another Application: Compiling under Unix misses the 
--embed flag
versions: 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



[issue37923] Combining typing.get_type_hints and inspect.signature

2019-08-22 Thread dmontague


New submission from dmontague :

I am trying to obtain the output of `inspect.signature`, except with 
string-valued annotations converted to resolved type hints, similarly to 
`typing.get_type_hints`.

Is there a good way to do this currently? If not, might this be a good fit for 
the standard library?

---

The straightforward way I see to attempt this would be to call both 
`typing.get_type_hints` and `inspect.signature` on the callable, and then 
"merge" the results. However, as far as I can tell, that only works if the 
provided callable is a function or method (i.e., not a type or a callable class 
instance).

As an example, if I have an instance of a class with a `__call__` method, and 
the class was defined in a module with `from __future__ import annotations`, 
then calling `inspect.signature` on the instances will only return an 
`inspect.Signature` with type-unaware strings as the annotations for each 
`inspect.Parameter`. On the other hand, calling `get_type_hints` on the 
instance will return type hints for the class, rather than for its `__call__` 
method.

I wouldn't mind manually handling an edge case or two, but the logic used by 
`inspect.signature` to determine which function will be called seems relatively 
involved, and so I would ideally like to leverage this same logic while 
obtaining the type-resolved version signature for the callable.

--
messages: 350248
nosy: dmontague, levkivskyi
priority: normal
severity: normal
status: open
title: Combining typing.get_type_hints and inspect.signature
type: enhancement
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



[issue29330] __slots__ needs documentation

2019-08-22 Thread Raymond Hettinger


Change by Raymond Hettinger :


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



[issue25898] Check for subsequence inside a sequence

2019-08-22 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> If I were trying to channel Raymond I'd suggest posting the 
> python as a recipe and see if there is uptake.  However, I
>  could be wrong and he might be interested.  (I can't say 
> that I've ever needed this check myself.)

Yes, exactly :-)

Sebastian, thanks for the suggestion.

I am going to decline this for collections and itertools based on the relative 
infrequency of need (for us, it usually only comes up in the context of 
strings).

FWIW, there may be algorithmically more advanced techniques that might be worth 
looking into: knuth-morris-pratt, rabin-karp, etc.

Please do post this to the Python Package Index or someother place where people 
can get to it if the need arises.

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



[issue14112] tutorial intro talks of "shallow copy" concept without explanation

2019-08-22 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
pull_requests: +15113
pull_request: https://github.com/python/cpython/pull/15408

___
Python tracker 

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



[issue30826] More details in reference 'Looping through a list in Python and modifying it'

2019-08-22 Thread Raymond Hettinger


Change by Raymond Hettinger :


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

___
Python tracker 

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



[issue37531] Fix regrtest timeout for subprocesses: regrtest -jN --timeout=SECONDS

2019-08-22 Thread Eryk Sun


Eryk Sun  added the comment:

> Is there a way to workaround that?

For Windows, subprocess could have a _read_all(file) method that special cases 
a pipe. The read loop for a pipe would check whether the child has exited. Then 
call _winapi.PeekNamedPipe on the handle (from get_osfhandle), and do a raw 
read of the available bytes. If the child has exited or PeekNamedPipe fails 
(EPIPE), then break, join the partial reads, decode and translate newlines if 
it's text mode, and return.

--

___
Python tracker 

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



[issue37884] Optimize Fraction() and statistics.mean()

2019-08-22 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

[Mark]
> I'm with Raymond here; I don't think this change is 
> desirable for the math module, either with or without 
> the leading underscore in the name.

[Jeroen]
> May I propose PR 15327 as alternative?

I'll take a look soonish.  Since it has its own BPO, I'll go ahead and close 
this.

FWIW, the entire point of us having recently added as_integer_ratio() methods 
to so many concrete classes is to avoid the need for helper functions in favor 
of a simple try/except around a single call.  Please don't try to code around 
that solution.

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



[issue37922] inspect.getsource returns wrong class definition when multiple class definitions share the same name (but are defined in different scopes)

2019-08-22 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

This looks like a duplicate of https://bugs.python.org/issue35113 . I have 
created a PR for the issue but didn't have time to debug the Windows issue.

--
nosy: +xtreak

___
Python tracker 

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



[issue24724] Element.findall documentation misleading

2019-08-22 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> Issue is closed as far as I'm concerned 

Me too.

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



[issue27561] Warn against subclassing builtins, and overriding their methods

2019-08-22 Thread Raymond Hettinger


Change by Raymond Hettinger :


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



[issue12634] Random Remarks in class documentation

2019-08-22 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
versions: +Python 3.8, Python 3.9 -Python 2.7, Python 3.2, Python 3.3, Python 
3.4

___
Python tracker 

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



[issue12634] Random Remarks in class documentation

2019-08-22 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
pull_requests: +15111
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/15406

___
Python tracker 

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



[issue37792] xml.etree.ElementTree.Element.__eq__ does compare only objects identity

2019-08-22 Thread Marco Sulla


Marco Sulla  added the comment:

Thanks, but telling the truth:

1. I just not use SubElement, even if it's more convenient. I just create an 
Element and I append to the parent one. It's much more clear IMHO

2. I do not use `fromstring` and all its friends. It was just a suggestion

3. I already copy/pasted from SO a function that serialize the Element. I do 
not want to waste time to do something that will be not used as 
`Element.__eq__()` implementation, as IMHO should be. 

See ya.

--

___
Python tracker 

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



[issue37922] inspect.getsource returns wrong class definition when multiple class definitions share the same name (but are defined in different scopes)

2019-08-22 Thread Caleb Donovick


Caleb Donovick  added the comment:

I think findsource could be made more robust by using __qualname__ if it 
available.

--

___
Python tracker 

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



[issue19441] itertools.tee improve documentation

2019-08-22 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

This is out of date.  The docs currently have:

''' Once :func:`tee` has made a split, the original *iterable* should not be 
used anywhere else; otherwise, the *iterable* could get advanced without the 
tee objects being informed.
'''

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



[issue37890] Modernize several tests in test_importlib

2019-08-22 Thread Kyle Stanley


Kyle Stanley  added the comment:

> I would just read through the other tests files under test_importlib to see 
> how other tests were done.

Okay, I'll start with that and report back with any ideas for potential changes 
to test_pkg_import. Thanks.

--

___
Python tracker 

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



[issue37922] inspect.getsource returns wrong class definition when multiple class definitions share the same name (but are defined in different scopes)

2019-08-22 Thread Caleb Donovick


Change by Caleb Donovick :


--
nosy: +donovick

___
Python tracker 

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



[issue24726] OrderedDict has strange behaviour when dict.__setitem__ is used.

2019-08-22 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

There may still be some holes still remaining in OrderedDict but it doesn't 
seem to have been relevant in practice and will become even less so now that 
regular dicts are ordered and compact.  

If an issue does are arise with someone setting OrderedDict values via 
dict.__setitem__ we should probably just document "don't do that" rather than 
performing brain surgery on the current implementation which was known in 
advance to be vulnerable to exactly this sort of trickery.

If there are no objections, I recommend closing this as out-of-date.   IMO this 
would be better than risking introducing new problems are getting the C version 
further out of sync with the Python version or altering how existing code is 
working.

--
priority: normal -> low

___
Python tracker 

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



[issue26589] Add HTTP Response code 451

2019-08-22 Thread Raymond Hettinger


Change by Raymond Hettinger :


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



[issue30550] Document order-preserving dictionary output in json

2019-08-22 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



[issue30550] Document order-preserving dictionary output in json

2019-08-22 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 4a40498ea96a3c606952712c7951b2ea4ab258e4 by Raymond Hettinger 
(Miss Islington (bot)) in branch '3.8':
bpo-30550: Clarify JSON ordering guarantees (GH-15397) (GH-15403)
https://github.com/python/cpython/commit/4a40498ea96a3c606952712c7951b2ea4ab258e4


--

___
Python tracker 

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



[issue37922] inspect.getsource returns wrong class definition when multiple class definitions share the same name (but are defined in different scopes)

2019-08-22 Thread Leonard Truong


Leonard Truong  added the comment:

Turns out this is a documented issue in the source code: 
https://github.com/python/cpython/blob/3.7/Lib/inspect.py#L794-L796

--

___
Python tracker 

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



[issue37922] inspect.getsource returns wrong class definition when multiple class definitions share the same name (but are defined in different scopes)

2019-08-22 Thread Leonard Truong

New submission from Leonard Truong :

Here's a case where `inspect.getsource` returns the wrong class definition when 
a file contains multiple class definitions with the same name. This pattern is 
valid runtime behavior when the class definitions are inside different scopes 
(e.g. a factory pattern where classes are defined and returned inside a 
function).

```
import inspect


def foo0():
class Foo:
x = 4
return Foo


def foo1():
class Foo:
x = 5
return Foo


print(inspect.getsource(foo1()))

print(foo1().x)
print(foo0().x)
```

Running this file produces
```
❯ python inspect-getsource-issue.py
class Foo:
x = 4

5
4
```

--
components: Library (Lib)
files: inspect-getsource-issue.py
messages: 350235
nosy: lennyt
priority: normal
severity: normal
status: open
title: inspect.getsource returns wrong class definition when multiple class 
definitions share the same name (but are defined in different scopes)
versions: Python 3.7
Added file: https://bugs.python.org/file48557/inspect-getsource-issue.py

___
Python tracker 

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



[issue30550] Document order-preserving dictionary output in json

2019-08-22 Thread miss-islington


Change by miss-islington :


--
pull_requests: +15110
pull_request: https://github.com/python/cpython/pull/15403

___
Python tracker 

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



[issue30550] Document order-preserving dictionary output in json

2019-08-22 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 657008ea0336ff4f275ed3f0c2b6dd2e52de2bba by Raymond Hettinger in 
branch 'master':
bpo-30550: Clarify JSON ordering guarantees (GH-15397)
https://github.com/python/cpython/commit/657008ea0336ff4f275ed3f0c2b6dd2e52de2bba


--

___
Python tracker 

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



[issue37531] Fix regrtest timeout for subprocesses: regrtest -jN --timeout=SECONDS

2019-08-22 Thread STINNER Victor


STINNER Victor  added the comment:

> This is an issue when the standard handles are inherited or duplicated to a 
> grandchild process, and so on. In the case of Popen(sys.executable), the 
> system is duplicating the standard handles implicitly because sys.executable 
> is a console process (assuming it's python[_d].exe), among other criteria. An 
> additional reference on the write side prevents the pipe from closing. 
> fh.read() in the grandparent won't return as long as there's a writer that 
> could potentially write more data.

Is there a way to workaround that?

--

___
Python tracker 

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



[issue37920] Support subscripting os.PathLike and make it valid at runtime

2019-08-22 Thread Guido van Rossum


Guido van Rossum  added the comment:

Sounds like you are mixing up analyzing .pyi and .py files.

Anyway, let's not do 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



[issue37921] Improve zipfile: add support for symlinks

2019-08-22 Thread Pierre-Jean Grenier


Change by Pierre-Jean Grenier :


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

___
Python tracker 

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



[issue37921] Improve zipfile: add support for symlinks

2019-08-22 Thread Pierre-Jean Grenier


New submission from Pierre-Jean Grenier :

The module tarfile contains some methods for knowing whether an archive member 
is a regular file/a directory/a symlink. Apart from an "is_dir()" method, there 
was nothing alike in the zipfile module. For an on-going project, I needed to 
know whether an archive member was a symlink or not, to prevent zip symlinks 
attacks.

I thought this could be of used for other people, given I struggled a little to 
find a way of saying if an archive member is a symlink or not.

This is why I think adding support for symlinks in the zipfile module could be 
a good idea.

--
components: Library (Lib)
messages: 350231
nosy: zaphodef
priority: normal
severity: normal
status: open
title: Improve zipfile: add support for symlinks
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



[issue37920] Support subscripting os.PathLike and make it valid at runtime

2019-08-22 Thread Cameron Trando


Cameron Trando  added the comment:

What happened is that we have a hard time analyzing PathLike because in the 
pathlib stub they use PathLike[str], so when we try to analyze Path which 
inherits from PathLike[str], because PathLike is not generic, then we think 
it's an instance of an object and don't inherit from it. That means Path has 
incorrect bases.

Previously we assumed we only had to special case typing so we will special 
case PathLike as well.

--

___
Python tracker 

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



[issue37920] Support subscripting os.PathLike and make it valid at runtime

2019-08-22 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

There is an (old) similar proposal https://github.com/python/typing/issues/402 
btw.

Taking into account that this can be made only in 3.9, what is the benefit over 
``from __future__ import annotations`` (that one can use already) do you see?

IMO there are only rare cases of type aliases and base classes, so I don't see 
much benefit. Also making it generic will require importing ``typing`` from 
``os`` which may make it slower to import (``typing`` is a really heavy module, 
in particular because it imports many other modules).

--

___
Python tracker 

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



[issue37920] Support subscripting os.PathLike and make it valid at runtime

2019-08-22 Thread Guido van Rossum


Guido van Rossum  added the comment:

Making an existing stdlib class generic has to be considered carefully, 
otherwise it may break backward compatibility.

As I wrote in the typeshed issue, I actually think the status quo is fine. But 
I'd like to hear you out about how it causes problems in VS Code (that can't be 
fixed by adapting VC Code to reality).

--
versions: +Python 3.9 -Python 3.7

___
Python tracker 

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



[issue37920] Support subscripting os.PathLike and make it valid at runtime

2019-08-22 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +gvanrossum, levkivskyi

___
Python tracker 

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



[issue37915] Segfault in comparison between datetime.timezone.utc and pytz.utc

2019-08-22 Thread miss-islington


Change by miss-islington :


--
pull_requests: +15107
pull_request: https://github.com/python/cpython/pull/15399

___
Python tracker 

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



[issue37915] Segfault in comparison between datetime.timezone.utc and pytz.utc

2019-08-22 Thread miss-islington


miss-islington  added the comment:


New changeset 4be11c009abe88175fa164b45e4838e7267dfa97 by Miss Islington (bot) 
(Pablo Galindo) in branch 'master':
bpo-37915: Fix comparison between tzinfo objects and timezone objects (GH-15390)
https://github.com/python/cpython/commit/4be11c009abe88175fa164b45e4838e7267dfa97


--
nosy: +miss-islington

___
Python tracker 

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



[issue11846] Remove non-guaranteed implementation details from docs.

2019-08-22 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

The current wording seems to have sufficed for users of the C API.  Also, it is 
an implementation detail subject to change.  Discussions on being able to 
mutate anything in C are covered in the ctypes module.

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



[issue37915] Segfault in comparison between datetime.timezone.utc and pytz.utc

2019-08-22 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
nosy: +lukasz.langa
priority: normal -> release blocker

___
Python tracker 

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



[issue34302] Avoid inefficient way to find start point in deque.index

2019-08-22 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

It looks like deque.index() now has a fast searcher.

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



[issue35654] Remove 'guarantee' that sorting only relies on __lt__ from sorting howto

2019-08-22 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> Well, if this is indeed by design (and I missed the
> list.sort() reference) then I agree the HOWTO should not be changed

It is in fact by design :-)

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



[issue37902] Add scrolling for IDLE browsers

2019-08-22 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Don't worry more about tests until I look at what you have done already.

--

___
Python tracker 

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



[issue37902] Add scrolling for IDLE browsers

2019-08-22 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

'mousescroll' was not exact because the mouse is also used to scroll with the 
scrollbar.  'handlescroll' is worse.  'wheelscroll' seems awkward. 
'scrollwheel' (scroll with the mouse wheel) is specific.  At least in idlelib, 
event handlers are routinely called something_event, so use 'wheel_event'.  
Pressing the wheel is a Button-3 event (there used to be 3-button mice before 
wheeels) and a handler for that would be 'button3_event' or 
'button3_press_event'.

--

___
Python tracker 

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



[issue37920] Support subscripting os.PathLike and make it valid at runtime

2019-08-22 Thread Cameron Trando


New submission from Cameron Trando :

Currently os.PathLike[str] causes a runtime error; however, typeshed sees it as 
valid and mypy does not throw any errors on it. 

mypy treats it as os.PathLike[AnyStr] 

I already filed a bug on typeshed, see 
https://github.com/python/typeshed/issues/3202

And since mypy interprets it as useful, cpython should try and support it as 
well.

--
messages: 350221
nosy: Cameron Trando
priority: normal
severity: normal
status: open
title: Support subscripting os.PathLike and make it valid at runtime
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



[issue28556] typing.py upgrades

2019-08-22 Thread miss-islington


miss-islington  added the comment:


New changeset 5fda09cc1ebcb364a660bc5a831ef8f6463d810b by Miss Islington (bot) 
in branch '3.8':
bpo-28556: Add a regression test to typing (GH-15396)
https://github.com/python/cpython/commit/5fda09cc1ebcb364a660bc5a831ef8f6463d810b


--

___
Python tracker 

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



[issue28556] typing.py upgrades

2019-08-22 Thread miss-islington


Change by miss-islington :


--
pull_requests: +15106
pull_request: https://github.com/python/cpython/pull/15398

___
Python tracker 

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



[issue37663] Making venv activation script prompts consistent

2019-08-22 Thread Brett Cannon


Change by Brett Cannon :


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



[issue37661] venv activation scripts erroneously check if __VENV_PROMPT__ is defined

2019-08-22 Thread Brett Cannon


Brett Cannon  added the comment:

Fixed by issue37663.

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



[issue37660] Drop support for Aspen magic directories in venv's activate scripts

2019-08-22 Thread Brett Cannon


Brett Cannon  added the comment:

Fixed by issue37663.

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



[issue37890] Modernize several tests in test_importlib

2019-08-22 Thread Brett Cannon


Brett Cannon  added the comment:

I would just read through the other tests files under test_importlib to see how 
other tests were done.

--

___
Python tracker 

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



[issue37902] Add scrolling for IDLE browsers

2019-08-22 Thread George Zhang


George Zhang  added the comment:

Also, how should I get the new code coverage percentage  (or should it be 
ignored for now)?

I'm thinking of adding a few more tests that send invalid events which would 
raise KeyError but I don't think that this behaviour will be used  (and it's 
not documented). Should it give a more specific error message?

The test for multicall is only targeting the MultiCall class that gets 
returned.  How should it check for any possible subclasses of it?

--

___
Python tracker 

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



[issue37918] What about an enum for open() modes?

2019-08-22 Thread Brett Cannon


Change by Brett Cannon :


--
priority: normal -> low
type:  -> enhancement

___
Python tracker 

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



[issue28556] typing.py upgrades

2019-08-22 Thread miss-islington


miss-islington  added the comment:


New changeset 8889627b53e1eea2e32590f1867fbb0b0fc7407f by Miss Islington (bot) 
(Ivan Levkivskyi) in branch 'master':
bpo-28556: Add a regression test to typing (GH-15396)
https://github.com/python/cpython/commit/8889627b53e1eea2e32590f1867fbb0b0fc7407f


--

___
Python tracker 

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



[issue30550] Document order-preserving dictionary output in json

2019-08-22 Thread Raymond Hettinger


Change by Raymond Hettinger :


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

___
Python tracker 

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



[issue37919] nntplib throws spurious NNTPProtocolError

2019-08-22 Thread Mark Sapiro


New submission from Mark Sapiro :

This is really due to an nntp server bug, but here's the scenerio.

A connection is opened to the server.

An article is posted via the connection's post() method.

The server responds to the article data with

240 Article posted 

but due to the server bug, if the message-id is long, this response comes on 
two lines as

240 Article posted
 

The post() method reads only the first line and returns it.

Then the connection's quit() method (or some other method) is called, and it 
sees the second line of the prior response as the server's response rather than 
the actual response, and raises NNTPProtocolError.

Arguably, NNTPProtocolError is appropriate in this scenario, but if so, it 
should be raised by the post() method and not by a subsequent method.

--
components: Library (Lib)
messages: 350214
nosy: msapiro
priority: normal
severity: normal
status: open
title: nntplib throws spurious NNTPProtocolError
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



[issue14050] Tutorial, list.sort() and items comparability

2019-08-22 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



[issue14050] Tutorial, list.sort() and items comparability

2019-08-22 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset cb8de91dadf15925fb95069cb190398e1d485f56 by Raymond Hettinger 
(Miss Islington (bot)) in branch '3.8':
bpo-14050: Note that not all data can be sorted (GH-15381) (GH-15395)
https://github.com/python/cpython/commit/cb8de91dadf15925fb95069cb190398e1d485f56


--

___
Python tracker 

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



[issue24413] Inconsistent behavior between set and dict_keys/dict_items: for non-iterable object x, set().__or__(x) returns NotImplemented, but {}.keys().__or__(x) raises TypeError

2019-08-22 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> If this is only a theoretical problem, might it make sense 
> to just leave it as is?

I'm fine with that.  In the last four years, I'm the only one who ever noticed, 
so it doesn't appear to be a problem in practice.

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



[issue23987] docs about containers membership testing wrong for broken objects

2019-08-22 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

It looks like the identity-implies-equality part of this has already been taken 
care of.   The __hash__ invariant also appears to now have extensive coverage, 
some in the glossary and much more in the data model section of the reference.  
Cute puzzles like a __hash__ returning a random value can be left for 
stackoverflow.

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



[issue28556] typing.py upgrades

2019-08-22 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
pull_requests: +15104
pull_request: https://github.com/python/cpython/pull/15396

___
Python tracker 

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



[issue37902] Add scrolling for IDLE browsers

2019-08-22 Thread George Zhang


George Zhang  added the comment:

I renamed mousescroll to handlescroll as it's an independent callback function 
and I think it fits its use case better.  I can keep it as mousescroll if you 
like though.

The handlescroll function is now a standalone module function in tree.py and 
the EditorWindow imports it for use  (instead of creating its own function).  
Its signature is `handlescroll(event, widget=None)` where event is the event 
(yeah...) and widget is an optional argument that overrides the widget to call 
`yview(SCROLL, lines, "units")` on.

The second argument was added so that the nasty labels don't have to use the 
same function but with one line changed  (we redirect handlescroll to use 
`self.canvas` because `event.widget` would refer to the Label which has no 
yview function).

I've added tests on handlescroll with different events.  I've also added a test 
on multicall that checks to test if MultiCallCreator overrides yview.

Sorry about the PR closing and reopening. I was panicking about commiting more 
than once and saw that I should make a new branch for the patch  (instead of 
using master branch).

--

___
Python tracker 

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



[issue32554] random.seed(tuple) uses the randomized hash function and so is not reproductible

2019-08-22 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



[issue32554] random.seed(tuple) uses the randomized hash function and so is not reproductible

2019-08-22 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset d0cdeaab76fef8a6e5a04665df226b6659111e4e by Raymond Hettinger in 
branch 'master':
bpo-32554: Deprecate hashing arbitrary types in random.seed() (GH-15382)
https://github.com/python/cpython/commit/d0cdeaab76fef8a6e5a04665df226b6659111e4e


--

___
Python tracker 

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



[issue14050] Tutorial, list.sort() and items comparability

2019-08-22 Thread miss-islington


Change by miss-islington :


--
pull_requests: +15103
pull_request: https://github.com/python/cpython/pull/15395

___
Python tracker 

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



[issue14050] Tutorial, list.sort() and items comparability

2019-08-22 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 4109263a7edce11194e301138cf66fa2d07f7ce4 by Raymond Hettinger in 
branch 'master':
bpo-14050: Note that not all data can be sorted (GH-15381)
https://github.com/python/cpython/commit/4109263a7edce11194e301138cf66fa2d07f7ce4


--

___
Python tracker 

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



[issue27961] remove support for platforms without "long long"

2019-08-22 Thread miss-islington


miss-islington  added the comment:


New changeset d0da97de65985ea4fc69cade2343d931f8b9efcd by Miss Islington (bot) 
in branch '3.7':
bpo-27961: Remove leftovers from the times when long long wasn't required 
(GH-15388)
https://github.com/python/cpython/commit/d0da97de65985ea4fc69cade2343d931f8b9efcd


--

___
Python tracker 

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



[issue27961] remove support for platforms without "long long"

2019-08-22 Thread miss-islington


miss-islington  added the comment:


New changeset 2878f378e02990303a8fe4bedd5386bd90efc26d by Miss Islington (bot) 
in branch '3.8':
bpo-27961: Remove leftovers from the times when long long wasn't required 
(GH-15388)
https://github.com/python/cpython/commit/2878f378e02990303a8fe4bedd5386bd90efc26d


--
nosy: +miss-islington

___
Python tracker 

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



[issue37917] Warning regarding collections ABCs still present in 3.9

2019-08-22 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Please see discussion at issue36953 and issue37324. It's currently blocked by 
Jinja that doesn't have a release with the fix to be used in CI.

--
nosy: +xtreak

___
Python tracker 

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



[issue37917] Warning regarding collections ABCs still present in 3.9

2019-08-22 Thread STINNER Victor


STINNER Victor  added the comment:

It's a work-in-progress: see bpo-37324.

--
nosy: +vstinner
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> collections: remove deprecated aliases to ABC classes

___
Python tracker 

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



[issue37918] What about an enum for open() modes?

2019-08-22 Thread Marco Sulla


New submission from Marco Sulla :

As title. I just created it:

https://pastebin.com/pNYezw2V

I think it could be useful to have a more descriptive way to declare a file 
open mode. Many languages has an enum for this.

Maybe open(), os.fdopen(), os.popen() and pathlib.Path.open() can just accept 
also an OpenMode enum as mode parameter, without the need to write 
OpenMode.append.value, for example, but just OpenMode.append. As an 
alternative, OpenMode could be a namedtuple.

I don't know in which module should be put. In `builtins`, `os` or `pathlib`?

--
components: Library (Lib)
messages: 350203
nosy: Marco Sulla
priority: normal
severity: normal
status: open
title: What about an enum for open() modes?
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



[issue37917] Warning regarding collections ABCs still present in 3.9

2019-08-22 Thread Michael Anckaert


New submission from Michael Anckaert :

When importing an ABC from the collections module in Python 3.9 there is a 
warning that this is deprecated since Python 3.3 and will stop working in 
Python 3.9. 

Should this warning be removed and lead to an ImportError? 

Python 3.9.0a0 (heads/master:a38e9d1399, Aug 22 2019, 17:48:16) 
[GCC 8.3.1 20190223 (Red Hat 8.3.1-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from collections import Sequence
:1: DeprecationWarning: Using or importing the ABCs from 'collections' 
instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it 
will stop working

--
components: Library (Lib)
messages: 350202
nosy: michaelanckaert
priority: normal
severity: normal
status: open
title: Warning regarding collections ABCs still present in 3.9
type: behavior
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



[issue37914] class timedelta, support the method hours and minutes in field accessors

2019-08-22 Thread Michael Anckaert


Michael Anckaert  added the comment:

Thank you for the clarification Paul. It makes sense to me now to not
include those accessors.

On Thu, 22 Aug 2019 at 17:46, Paul Ganssle  wrote:

>
> Paul Ganssle  added the comment:
>
> > I would support this addition. The timedelta class already has accessors
> for days and seconds, why not for hours and minutes?
>
> The `timedelta.days` and `timedelta.seconds` accessors do not do what is
> being requested here. The component accessors just give you a given
> component of the timedelta in its normalized form, so:
>
> >>> td = timedelta(hours=25, minutes=1, seconds=2)
> >>> td.days
> 1
> >>> td.seconds
> 3662
> >>> td // timedelta(seconds=1)
> 90062
>
>
> The reason there is no hours or minutes is that the normalized form of
> timedelta doesn't have those components. It would be inconsistent to have
> `hours` and `minutes` give the total duration of the timedelta in the
> chosen units while `.days` and `.seconds` return just the component of the
> normalized form.
>
> What's really being asked for here are `total_hours()` and
> `total_minutes()` methods, and when that has come up in the past (including
> recently on the python-dev mailing list), we've largely decided that the
> "divide by the units you want" idiom is sufficient (and in fact better in
> that you can choose any arbitrary units rather than just the ones that have
> specific names).
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue37914] class timedelta, support the method hours and minutes in field accessors

2019-08-22 Thread Paul Ganssle


Paul Ganssle  added the comment:

> I would support this addition. The timedelta class already has accessors for 
> days and seconds, why not for hours and minutes? 

The `timedelta.days` and `timedelta.seconds` accessors do not do what is being 
requested here. The component accessors just give you a given component of the 
timedelta in its normalized form, so:

>>> td = timedelta(hours=25, minutes=1, seconds=2)
>>> td.days
1
>>> td.seconds
3662
>>> td // timedelta(seconds=1)
90062


The reason there is no hours or minutes is that the normalized form of 
timedelta doesn't have those components. It would be inconsistent to have 
`hours` and `minutes` give the total duration of the timedelta in the chosen 
units while `.days` and `.seconds` return just the component of the normalized 
form.

What's really being asked for here are `total_hours()` and `total_minutes()` 
methods, and when that has come up in the past (including recently on the 
python-dev mailing list), we've largely decided that the "divide by the units 
you want" idiom is sufficient (and in fact better in that you can choose any 
arbitrary units rather than just the ones that have specific names).

--

___
Python tracker 

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



[issue17306] Improve the way abstract base classes are shown in help()

2019-08-22 Thread Michael Anckaert


Michael Anckaert  added the comment:

I would be very interested and motivated to work on this. I'll start by taking 
a look at the pointers Raymond gave. If anyone can chime in with some more 
information / guidance that would be awesome.

--
nosy: +michaelanckaert

___
Python tracker 

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



[issue37914] class timedelta, support the method hours and minutes in field accessors

2019-08-22 Thread Michael Anckaert


Michael Anckaert  added the comment:

I would support this addition. The timedelta class already has accessors for 
days and seconds, why not for hours and minutes? 


The implementation should make use of the idiomatic way as Serhiy mentioned.  

>>> timedelta(hours=25).seconds // 3600
1

Is wrong, it should be

>>> timedelta(hours=25) // timedelta(hours=1)
25

>>> timedelta(hours=24) // timedelta(hours=1)
24

--
nosy: +michaelanckaert

___
Python tracker 

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



[issue27961] remove support for platforms without "long long"

2019-08-22 Thread miss-islington


Change by miss-islington :


--
pull_requests: +15102
pull_request: https://github.com/python/cpython/pull/15393

___
Python tracker 

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



[issue27961] remove support for platforms without "long long"

2019-08-22 Thread miss-islington


Change by miss-islington :


--
pull_requests: +15101
pull_request: https://github.com/python/cpython/pull/15392

___
Python tracker 

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



[issue27961] remove support for platforms without "long long"

2019-08-22 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset a38e9d139929a227e3899fbb638bc46c6cc6d8ba by Pablo Galindo (Sergey 
Fedoseev) in branch 'master':
bpo-27961: Remove leftovers from the times when long long wasn't required 
(GH-15388)
https://github.com/python/cpython/commit/a38e9d139929a227e3899fbb638bc46c6cc6d8ba


--
nosy: +pablogsal

___
Python tracker 

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



[issue37915] Segfault in comparison between datetime.timezone.utc and pytz.utc

2019-08-22 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Thanks, Tom and Karthikeyan for the finding and the debugging :)

--

___
Python tracker 

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



[issue37915] Segfault in comparison between datetime.timezone.utc and pytz.utc

2019-08-22 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

This is due to an incorrect type check in the timezone_richcompare, it should 
be a comparison against PyDateTime_TimeZoneType not against 
PyDateTime_TZInfoType. The segfault is due to an invalid casting to 
PyDateTime_TimeZoneType (the child) from the parent (PyDateTime_TZInfoType).

--
nosy: +pablogsal

___
Python tracker 

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



[issue37915] Segfault in comparison between datetime.timezone.utc and pytz.utc

2019-08-22 Thread Tom Augspurger


Tom Augspurger  added the comment:

Thanks for debugging this Karthikeyan and for the quick fix Pablo!

--

___
Python tracker 

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



[issue37549] os.dup() fails for standard streams on Windows 7

2019-08-22 Thread Steve Dower


Steve Dower  added the comment:

Thanks Zackery for the patch!

> The problem is just console pseudohandles in Windows 7 and earlier.

Should we add a version check as well [1]? I'm not totally comfortable with 
bitmasking a handle here, but if we only do this additional check on Win7 then 
I'm okay with it.

And if we add the check, I'd rather this be a function than a macro. It's 
getting too complicated to read :)

[1]: 
https://docs.microsoft.com/en-us/windows/win32/api/versionhelpers/nf-versionhelpers-iswindows8orgreater

--

___
Python tracker 

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



[issue37915] Segfault in comparison between datetime.timezone.utc and pytz.utc

2019-08-22 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue37549] os.dup() fails for standard streams on Windows 7

2019-08-22 Thread Zackery Spytz


Change by Zackery Spytz :


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

___
Python tracker 

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



[issue37884] Optimize Fraction() and statistics.mean()

2019-08-22 Thread Jeroen Demeyer


Jeroen Demeyer  added the comment:

May I propose PR 15327 as alternative? It solves some of the same issues as the 
PR on this issue, in particular supporting arbitrary objects with 
as_integer_ratio(). It also improves performance somewhat for certain inputs, 
but that's more by accident.

--

___
Python tracker 

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



[issue37531] Fix regrtest timeout for subprocesses: regrtest -jN --timeout=SECONDS

2019-08-22 Thread Eryk Sun


Eryk Sun  added the comment:

> It seems like self.stdout.read() hangs even after the child process 
> has been killed.

This is an issue when the standard handles are inherited or duplicated to a 
grandchild process, and so on. In the case of Popen(sys.executable), the system 
is duplicating the standard handles implicitly because sys.executable is a 
console process (assuming it's python[_d].exe), among other criteria. An 
additional reference on the write side prevents the pipe from closing. 
fh.read() in the grandparent won't return as long as there's a writer that 
could potentially write more data.

--

___
Python tracker 

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



[issue26680] Incorporating float.is_integer into the numeric tower and Decimal

2019-08-22 Thread Guido van Rossum


Guido van Rossum  added the comment:

It should not go on the numeric tower.
-- 
--Guido (mobile)

--

___
Python tracker 

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



[issue37915] Segfault in comparison between datetime.timezone.utc and pytz.utc

2019-08-22 Thread Karthikeyan Singaravelan

Karthikeyan Singaravelan  added the comment:

Seems this is due to issue37685 (dde944f9df) on bisecting datetime related 
changes. Adding Serhiy. I guess this could be marked as release blocker.

Here is a simplified reproducer on extracting pytz.utc source [0] which is an 
object of simple subclass of datetime.tzinfo : 

import sys
import datetime

print(sys.version)
class UTC(datetime.tzinfo):
pass

print(datetime.timezone.utc == UTC())
datetime.timezone.utc == datetime.tzinfo() # This also segfaults without a 
subclass and should be False

# Segfaults

➜  cpython git:(dde944f9df) git checkout dde944f9df && make -s -j4 > /dev/null
HEAD is now at dde944f9df bpo-37685: Fixed comparisons of datetime.timedelta 
and datetime.timezone. (GH-14996)
➜  cpython git:(dde944f9df) ./python.exe ../backups/bpo37915.py
3.8.0b3+ (tags/v3.8.0b3-30-gdde944f9df:dde944f9df, Aug 22 2019, 17:55:14)
[Clang 7.0.2 (clang-700.1.81)]
[1]33988 segmentation fault  ./python.exe ../backups/bpo37915.py

# Commit before works fine

➜  cpython git:(dde944f9df) git checkout dde944f9df~1 && make -s -j4 > /dev/null
Previous HEAD position was dde944f9df bpo-37685: Fixed comparisons of 
datetime.timedelta and datetime.timezone. (GH-14996)
HEAD is now at 4e402d37eb Correct description of HTTP status code 308. 
(GH-15098)
➜  cpython git:(4e402d37eb) ./python.exe ../backups/bpo37915.py
3.8.0b3+ (tags/v3.8.0b3-30-gdde944f9df:dde944f9df, Aug 22 2019, 17:55:14)
[Clang 7.0.2 (clang-700.1.81)]
False


[0] 
https://github.com/stub42/pytz/blob/62f872054dde69e5c510094093cd6e221d96d5db/src/pytz/__init__.py#L256

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue37914] class timedelta, support the method hours and minutes in field accessors

2019-08-22 Thread Elinaldo Monteiro


Elinaldo Monteiro  added the comment:

Imagine the following scenario.

from datetime import timedelta
diff = timedelta(hours=23, minutes=59) - timedelta(hours=20, minutes=45)

Which is the simplest ?

diff.hours

diff.total_seconds() // 3600

--

___
Python tracker 

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



[issue37914] class timedelta, support the method hours and minutes in field accessors

2019-08-22 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It was already proposed several times before.

The problem is that what do you expect to get from timedelta(hours=24).hours?

The idiomatic way to convert a timedelta object to a number of hours is:

td = timedelta(...)
number_of_hours = td // timedelta(hours=1)

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue37915] Segfault in comparison between datetime.timezone.utc and pytz.utc

2019-08-22 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
title: Segfault in comparison between datetime.timezone.utc and putz.utc -> 
Segfault in comparison between datetime.timezone.utc and pytz.utc

___
Python tracker 

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



[issue37915] Segfault in comparison between datetime.timezone.utc and putz.utc

2019-08-22 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

I am adding 3.8 regression since the code works with 3.7 though it involves 
pytz.

--
keywords: +3.8regression
nosy: +belopolsky, p-ganssle, xtreak

___
Python tracker 

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



[issue27961] remove support for platforms without "long long"

2019-08-22 Thread Sergey Fedoseev


Change by Sergey Fedoseev :


--
pull_requests: +15098
pull_request: https://github.com/python/cpython/pull/15388

___
Python tracker 

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



[issue37907] speed-up PyLong_As*() for large longs

2019-08-22 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +serhiy.storchaka, vstinner

___
Python tracker 

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



[issue37916] distutils: allow overriding of the RANLIB command on macOS (darwin)

2019-08-22 Thread Roundup Robot


Change by Roundup Robot :


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

___
Python tracker 

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



[issue37916] distutils: allow overriding of the RANLIB command on macOS (darwin)

2019-08-22 Thread Jakub Piotr Cłapa

New submission from Jakub Piotr Cłapa :

On a macOS hosts the system ranlib does not understand ELF
files so using the "ranlib" command causes errors during cross-compilations.

The simplest way to fix it is to pass the RANLIB parameter provided to setup.py 
through to the distutils compiler machinery. This is analogous to the way the 
C/C++ cross-compiler is configured.

This change (in a GitHub PR) was required to proceed with crosscompiling numpy. 
It should help with other packages too (if they use distutils and need ranlib).

--
components: Cross-Build
messages: 350185
nosy: Alex.Willmer, Jakub Piotr Cłapa
priority: normal
severity: normal
status: open
title: distutils: allow overriding of the RANLIB command on macOS (darwin)
type: compile error

___
Python tracker 

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



[issue27961] remove support for platforms without "long long"

2019-08-22 Thread Sergey Fedoseev


Change by Sergey Fedoseev :


--
pull_requests: +15095
pull_request: https://github.com/python/cpython/pull/15386

___
Python tracker 

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



[issue37915] Segfault in comparison between datetime.timezone.utc and putz.utc

2019-08-22 Thread Tom Augspurger


New submission from Tom Augspurger :

The following crashes with Python 3.8b3

```
import sys
import pytz
import datetime

print(sys.version_info)
print(pytz.__version__)
print(datetime.timezone.utc == pytz.utc)
```

When run with `-X faulthandler`, I see

```
sys.version_info(major=3, minor=8, micro=0, releaselevel='beta', serial=3)
2019.2
Fatal Python error: Segmentation fault

Current thread 0x0001138dc5c0 (most recent call first):
  File "foo.py", line 8 in 
Segmentation fault: 11
```

--
messages: 350184
nosy: tomaugspurger
priority: normal
severity: normal
status: open
title: Segfault in comparison between datetime.timezone.utc and putz.utc
type: crash
versions: Python 3.8

___
Python tracker 

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



[issue37907] speed-up PyLong_As*() for large longs

2019-08-22 Thread Ma Lin


Change by Ma Lin :


--
nosy: +Ma Lin

___
Python tracker 

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



[issue37914] class timedelta, support the method hours and minutes in field accessors

2019-08-22 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +belopolsky, p-ganssle

___
Python tracker 

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



  1   2   >