[issue38225] iscoroutinefunction broken with cython - allow tagging of functions as async?

2019-12-23 Thread Stefan Behnel


Stefan Behnel  added the comment:

FWIW, it seems reasonable to have a protocol for this.

--

___
Python tracker 

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



[issue39129] Incorrect import of TimeoutError while creating happy eyeballs connection

2019-12-23 Thread Karthikeyan Singaravelan


New submission from Karthikeyan Singaravelan :

I guess the TimeoutError exception needs to be imported from asyncio.exceptions 
and not from asyncio.futures that causes AttributeError while instantiating a 
connection with happy eyeballs.

./python.exe -m asyncio
asyncio REPL 3.9.0a2+ (heads/master:068768faf6, Dec 23 2019, 18:35:26)
[Clang 10.0.1 (clang-1001.0.46.4)] on darwin
Use "await" directly instead of "asyncio.run()".
Type "help", "copyright", "credits" or "license" for more information.
>>> import asyncio
>>> conn = await asyncio.open_connection("localhost", port=8000, 
>>> happy_eyeballs_delay=1)
Traceback (most recent call last):
  File "/Users/kasingar/stuff/python/cpython/Lib/concurrent/futures/_base.py", 
line 439, in result
return self.__get_result()
  File "/Users/kasingar/stuff/python/cpython/Lib/concurrent/futures/_base.py", 
line 388, in __get_result
raise self._exception
  File "", line 1, in 
  File "/Users/kasingar/stuff/python/cpython/Lib/asyncio/streams.py", line 52, 
in open_connection
transport, _ = await loop.create_connection(
  File "/Users/kasingar/stuff/python/cpython/Lib/asyncio/base_events.py", line 
1041, in create_connection
sock, _, _ = await staggered.staggered_race(
  File "/Users/kasingar/stuff/python/cpython/Lib/asyncio/staggered.py", line 
144, in staggered_race
raise d.exception()
  File "/Users/kasingar/stuff/python/cpython/Lib/asyncio/staggered.py", line 
86, in run_one_coro
with contextlib.suppress(futures.TimeoutError):
AttributeError: module 'asyncio.futures' has no attribute 'TimeoutError'

--
components: asyncio
messages: 358841
nosy: asvetlov, xtreak, yselivanov
priority: normal
severity: normal
status: open
title: Incorrect import of TimeoutError while creating happy eyeballs connection
type: behavior
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



[issue39128] Document happy eyeball parameters in loop.create_connection signature docs

2019-12-23 Thread Karthikeyan Singaravelan


New submission from Karthikeyan Singaravelan :

Created from https://github.com/aio-libs/aiohttp/issues/4451 . 
happy_eyeballs_delay and interleave are not documented in the signature at [0] 
though the parameters were explained below . Andrew, feel free to update if 
there is any additional action needed besides signature update. I guess it 
could be tagged as a good newcomer friendly issue.

[0] 
https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.loop.create_connection

--
assignee: docs@python
components: Documentation, asyncio
messages: 358840
nosy: asvetlov, docs@python, xtreak, yselivanov
priority: normal
severity: normal
status: open
title: Document happy eyeball parameters in loop.create_connection signature 
docs
type: enhancement
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



[issue39127] _Py_HashPointer's void * argument should be const

2019-12-23 Thread Andy Lester


Change by Andy Lester :


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

___
Python tracker 

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



[issue39127] _Py_HashPointer's void * argument should be const

2019-12-23 Thread Andy Lester


New submission from Andy Lester :

_Py_HashPointer in Python/pyhash.c takes a pointer argument that can be made 
const.  This will let compiler and static analyzers know that the pointer's 
target is not modified.  You can also change calls to _Py_HashPointer that are 
down-casting pointers.

For example, in meth_hash in Objects/methodobject.c, this call can have the 
void * changed to const void *.

y = _Py_HashPointer((void*)(a->m_ml->ml_meth));

--
components: Interpreter Core
messages: 358839
nosy: petdance
priority: normal
severity: normal
status: open
title: _Py_HashPointer's void * argument should be const

___
Python tracker 

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



[issue39126] Non-bmp (astral) unicode characters confuse the editor

2019-12-23 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

I am aware of this.  Before the recent (Oct 4) fix for #13153, pasting an 
astral character into an edit line or window crashed IDLE.  After the fix, the 
character appears (and printing such chars also works reliably).  But astral 
chars confuse the tk text widget, which cannot properly handle them. (I believe 
that they are stored as 2 surrogate chars, displayed as one.)

I don't want to immediately replace such chars with escape sequences.

>>> hex(ord(''))
'0x1f606'
>>> '\U0001f606'
''

The effect is limited to the line containing the odd char, and once entered, 
strange cursor placement does not matter too much.  But we probably should 
document the situation and add an option to escape or unescape such chars.

--
title: Some characters confuse the editor -> Non-bmp (astral) unicode 
characters confuse the editor
versions: +Python 3.9 -Python 3.8

___
Python tracker 

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



[issue37340] remove free_list for bound method objects

2019-12-23 Thread Eric Snow


Change by Eric Snow :


--
nosy: +eric.snow

___
Python tracker 

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



[issue11986] Min/max not symmetric in presence of NaN

2019-12-23 Thread Marco Sulla


Marco Sulla  added the comment:

marco@buzz:~$ python3.9
Python 3.9.0a0 (heads/master-dirty:d8ca2354ed, Oct 30 2019, 20:25:01) 
[GCC 9.2.1 20190909] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from decimal import Decimal as Dec, BasicContext as Bctx
>>> a = Dec("1981", Bctx)
>>> b = Dec("nan", Bctx)
>>> a.max(b)
Decimal('1981')
>>> b.max(a)
Decimal('1981')
>>> Bctx.max(a, b)
Decimal('1981')
>>> Bctx.max(b, a)
Decimal('1981')


`Decimal` completely adheres to IEEE 754 standard.

There's a very, very simple and generic solution for builtin min and max:



_sentinel = object()

def max(*args, key=None, default=_sentinel):
args_len = len(args)

if args_len == 0:
if default is _sentinel:
fname = max.__name__
raise ValueError(f"{fname}() expected 1 argument, got 0")

return default
elif args_len == 1:
seq = args[0]
else:
seq = args

it = iter(seq)

vmax = next(it, _sentinel)

if vmax is _sentinel:
if default is _sentinel:
fname = max.__name__
raise ValueError(f"{fname}() arg is an empty sequence")

return default


first_comparable = False

if key is None:
for val in it:
if vmax < val:
vmax = val
first_comparable = True
elif not first_comparable and not val < vmax :
# equal, or not comparable object, like NaN
vmax = val
else:
fmax = key(vmax)

for val in it:
fval = key(val)

if fmax < fval :
fmax = fval
vmax = val
first_comparable = True
elif not first_comparable and not fval < fmax:
fmax = fval
vmax = val

return vmax


This function continues to give undefined behavior with sets... but who 
calculates the "maximum" or "minimum" of sets?

--
nosy: +Marco Sulla

___
Python tracker 

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



[issue39126] Some characters confuse the editor

2019-12-23 Thread dmaxime

New submission from dmaxime :

>>> b'\xf0\x9f\x98\x86'.decode('utf8')
''
>>> ''.encode('utf8')
b'\xf0\x9f\x98\x86'

...now if you write ''.encode() then you move the cursor between the brackets 
and type "'utf8'" you will have this result while the cursor remains in the 
brackets:

>>> ''.encode()''8ftu
SyntaxError: invalid syntax
>>>

I've attached a video that shows this behavior.
Thanks for your attention. Cheers.

--
assignee: terry.reedy
components: IDLE
files: python3ide bug.mp4
messages: 358836
nosy: dmaxime, terry.reedy
priority: normal
severity: normal
status: open
title: Some characters confuse the editor
type: behavior
versions: Python 3.8
Added file: https://bugs.python.org/file48801/python3ide bug.mp4

___
Python tracker 

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



[issue36095] Better NaN sorting.

2019-12-23 Thread Marco Sulla


Marco Sulla  added the comment:

Excuse me, ignore my previous post.

--

___
Python tracker 

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



[issue36095] Better NaN sorting.

2019-12-23 Thread Marco Sulla


Marco Sulla  added the comment:

marco@buzz:~$ python3.9
Python 3.9.0a0 (heads/master-dirty:d8ca2354ed, Oct 30 2019, 20:25:01) 
[GCC 9.2.1 20190909] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from decimal import Decimal as Dec, BasicContext as Bctx
>>> a = Dec("1981", Bctx)
>>> b = Dec("nan", Bctx)
>>> a.max(b)
Decimal('1981')
>>> b.max(a)
Decimal('1981')
>>> Bctx.max(a, b)
Decimal('1981')
>>> Bctx.max(b, a)
Decimal('1981')

--

___
Python tracker 

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



[issue37093] http.client aborts header parsing upon encountering non-ASCII header names

2019-12-23 Thread Tim Burke


Tim Burke  added the comment:

Note that because http.server uses http.client to parse headers [0], this can 
pose a request-smuggling vector depending on how you've designed your system. 
For example, you might have a storage system with a user-facing HTTP server 
that is in charge of

* authenticating and authorizing users,
* determining where data should be stored, and
* proxying the user request to the backend

and a separate (unauthenticated) HTTP server for actually storing that data. If 
the proxy and backend are running different versions of CPython (say, because 
you're trying to upgrade an existing py2 cluster to run on py3), they may 
disagree about where the request begins and ends -- potentially causing the 
backend to process multiple requests, only the first of which was authorized.

See, for example, https://bugs.launchpad.net/swift/+bug/1840507

For what it's worth, most http server libraries (that I tested; take it with a 
grain of salt) seem to implement their own header parsing. Eventlet was a 
notable exception [1].

[0] https://github.com/python/cpython/blob/v3.8.0/Lib/http/server.py#L336-L337
[1] https://github.com/eventlet/eventlet/pull/574

--

___
Python tracker 

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



[issue39115] Clarify Python MIME type

2019-12-23 Thread Josh de Kock


Josh de Kock  added the comment:

I just wanted the intended MIME type for sending python over various mediums to 
be written down somewhere other than the source code, but I'm not sure where it 
should go.

Though if you don't think it is necessary then that is fine too, I mostly just 
wanted someone else's opinion. After looking into it further I couldn't find 
much on other languages specifically stating which MIME you should use, it's 
mostly somewhat of an infrequent unofficial convention.

If you don't think there is an appropriate place to put this information, other 
than the source code itself, then feel free to close this bug. Thank you for 
your replies, and sorry for wasting your time.

--

___
Python tracker 

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



[issue39011] ElementTree attributes replace "\r" with "\n"

2019-12-23 Thread Stefan Behnel


Stefan Behnel  added the comment:

I think we did it wrong in issue 17582. Parser behaviour is not a reason why 
the *serialisation* should modify the content.

Luckily, fixing this does not impact the C14N serialisation (which aims to 
guarantee byte identical serialisation), but it changes the "normal" 
serialisation. I would therefore suggest that we remove the newline replacement 
code in the next release only, Py3.9.

@mefistotelis, do you want to submit a PR?

--
stage:  -> needs patch
versions: +Python 3.9 -Python 3.6, Python 3.8

___
Python tracker 

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



[issue31711] ssl.SSLSocket.send(b"") fails

2019-12-23 Thread Jörn Heissler

Jörn Heissler  added the comment:

Manpage (openssl 1.1.1d) now states:

You should not call SSL_write() with num=0, it will return an error.  
SSL_write_ex() can be called with num=0, but will not send application data to 
the peer. SSL_write_ex was added in 1.1.1

So it looks like openssl cleaned up another mistake by defining SSL_write_ex's 
behaviour to be a noop.

--

___
Python tracker 

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



[issue38878] os.PathLike subclasshook causes subclass checks true on abstract implementation

2019-12-23 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions:  -Python 3.6

___
Python tracker 

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



[issue38878] os.PathLike subclasshook causes subclass checks true on abstract implementation

2019-12-23 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:


New changeset 59d06b987db34cde8783e265709366d244c9e35b by Ivan Levkivskyi (Bar 
Harel) in branch '3.7':
[3.7] bpo-38878: Fix os.PathLike __subclasshook__ (GH-17336) (GH-17685)
https://github.com/python/cpython/commit/59d06b987db34cde8783e265709366d244c9e35b


--

___
Python tracker 

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



[issue38878] os.PathLike subclasshook causes subclass checks true on abstract implementation

2019-12-23 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:


New changeset 0846e5d4603434c2bbf8a528677cf1ff3fe29b95 by Ivan Levkivskyi (Bar 
Harel) in branch '3.8':
[3.8] bpo-38878: Fix os.PathLike __subclasshook__ (GH-17336) (GH-17684)
https://github.com/python/cpython/commit/0846e5d4603434c2bbf8a528677cf1ff3fe29b95


--

___
Python tracker 

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



[issue31711] ssl.SSLSocket.send(b"") fails

2019-12-23 Thread César

Change by César :


--
pull_requests: +17144
pull_request: https://github.com/python/cpython/pull/17671

___
Python tracker 

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



[issue32780] ctypes: memoryview gives incorrect PEP3118 format strings for both packed and unpacked structs

2019-12-23 Thread Ned Deily


Change by Ned Deily :


--
nosy: +vinay.sajip

___
Python tracker 

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



[issue39062] ValueError in TarFile.getmembers

2019-12-23 Thread jvoisin


jvoisin  added the comment:

Raising an except is ok, if it's documented, so I know which ones I should 
catch to prevent my program to quit when processing untrusted files, without 
having to catch `Exception`.

Reliability is important in my use-case as well, not only exploitable 
memory-corruption issues.

I'll try to reproduce future issues on more recent Python versions before 
reporting them :)

--

___
Python tracker 

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



[issue39114] Python 3.9.0a2 changed how finally/return is traced

2019-12-23 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
nosy: +pablogsal

___
Python tracker 

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



[issue38870] Expose ast.unparse in the ast module

2019-12-23 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset d69cbeb99d5fd0d5464e937202cca6a2024d1bcf by Pablo Galindo in 
branch 'master':
Revert "bpo-38870: Remove dependency on contextlib to avoid performance 
regression on import (GH-17376)" (GH-17687)
https://github.com/python/cpython/commit/d69cbeb99d5fd0d5464e937202cca6a2024d1bcf


--

___
Python tracker 

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



[issue39125] Type signature of @property not shown in help()

2019-12-23 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Currently docstring written for even property.setter is ignored in help as 
inspect.getdoc only inspects property.fget [0] for docstrings. I feel docs for 
setter could also be included. The docs also indicate the same at 
https://docs.python.org/3.6/library/functions.html#property . In the absence of 
docs maybe the signature for getter and setter could be included as per this 
proposal.

class Foo:
@property
def bar(self) -> int:
'''Bar docs for property'''
return 42

@bar.setter
def bar(self, value: int) -> None:
'''Bar docs for setter'''
pass

help(Foo.bar)

Help on property:

Bar docs for property


[0] 
https://github.com/python/cpython/blob/4b3b1226e86df6cd45e921c8f2ad23c3639c43b2/Lib/inspect.py#L580

--
nosy: +rhettinger, xtreak
versions:  -Python 3.5, 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



[issue38870] Expose ast.unparse in the ast module

2019-12-23 Thread Guido van Rossum


Change by Guido van Rossum :


--
nosy:  -gvanrossum

___
Python tracker 

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



[issue38870] Expose ast.unparse in the ast module

2019-12-23 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +17143
pull_request: https://github.com/python/cpython/pull/17687

___
Python tracker 

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



[issue38870] Expose ast.unparse in the ast module

2019-12-23 Thread Pablo Galindo Salgado

Pablo Galindo Salgado  added the comment:


New changeset 4b3b1226e86df6cd45e921c8f2ad23c3639c43b2 by Pablo Galindo 
(Batuhan Taşkaya) in branch 'master':
bpo-38870: Refactor delimiting with context managers in ast.unparse (GH-17612)
https://github.com/python/cpython/commit/4b3b1226e86df6cd45e921c8f2ad23c3639c43b2


--

___
Python tracker 

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



[issue39124] round Decimal error

2019-12-23 Thread Mark Dickinson

Mark Dickinson  added the comment:

@adelsonllima: Take a look at the documentation that I linked to for the round 
function, and in particular this note:

"The behavior of round() for floats can be surprising: for example, 
round(2.675, 2) gives 2.67 instead of the expected 2.68. This is not a bug: 
it’s a result of the fact that most decimal fractions can’t be represented 
exactly as a float. See Floating Point Arithmetic: Issues and Limitations for 
more information."

As Jörn Heissler observed, the issue here is that the numeric literal 9.925 in 
the source gets turned into a float whose exact value is just slightly larger 
than 9.925 (because 9.925 can't be exactly represented in the IEEE 754 binary64 
floating-point format that your machine is almost certainly using). So because 
it's a touch larger than 9.925, it rounds up when rounding to two decimal 
places.

Closing again here: believe it or not, round is working as designed here.

--

___
Python tracker 

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



[issue39125] Type signature of @property not shown in help()

2019-12-23 Thread Nguyễn Gia Phong

New submission from Nguyễn Gia Phong :

Dear Maintainer,

I want to request a feature on the generative documentation of type-hinting.
As of December 2019, I believe there is no support for generating such
information in help().  For demonstration, I have this tiny piece of code

class Foo:
@property
def bar(self) -> int: return 42

@bar.setter
def bar(self, value: int) -> None: pass

def baz(self, arg: float) -> str: pass

whose documentation on CPython 3.7.5 (on Debian testing amd64 if that matters)
is generated as

class Foo(builtins.object)
 |  Methods defined here:
 |  
 |  baz(self, arg: float) -> str
 |  
 |  --
 |  Data descriptors defined here:
 |  
 |  __dict__
 |  dictionary for instance variables (if defined)
 |  
 |  __weakref__
 |  list of weak references to the object (if defined)
 |  
 |  bar

I expect the documentation for bar to be as informative as bar, i.e. something
similar to ``bar: int''.  As pointed out by ChrisWarrick on freenode#python,
the annotations are already present, yet help() is not making use of them:

>>> Foo.bar.fget.__annotations__
{'return': }
>>> Foo.bar.fset.__annotations__
{'value': , 'return': None}

Have a Merry Christmas or other holiday of your choice,
Nguyễn Gia Phong

--
assignee: docs@python
components: Documentation
messages: 358823
nosy: McSinyx, docs@python
priority: normal
severity: normal
status: open
title: Type signature of @property not shown in help()
type: enhancement
versions: 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



[issue39124] round Decimal error

2019-12-23 Thread Mark Dickinson


Change by Mark Dickinson :


--
status: open -> closed
type: crash -> behavior

___
Python tracker 

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



[issue39124] round Decimal error

2019-12-23 Thread Jörn Heissler

Jörn Heissler  added the comment:

> round(9.925, 2) => 9.93

9.925 is 9.925710542735760100185871124267578125 on my platform.
This is larger than 9.925, so the "round-ties-to-even" rule can't be applied. 
Instead it is rounded up to 9.93 
(9.92971578290569595992565155029296875).

--
nosy: +joernheissler

___
Python tracker 

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



[issue39124] round Decimal error

2019-12-23 Thread Adelson Luiz de Lima


Adelson Luiz de Lima  added the comment:

Thanks for the quick response. 
I try the follow code in python 3.7: 
round(9.925, 2) => 9.93
round(Decimal('9.925'), 2) => Decimal('9.92')

I do not understande why behavior of float is diferrent of the Decimal.

In python 2.7 I have the same result: 9.93

--
status: closed -> open

___
Python tracker 

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



[issue38914] Clarify wording for warning message when checking a package

2019-12-23 Thread miss-islington

miss-islington  added the comment:


New changeset 9f9dac0a4e58d5c72aa3b644701cb155c009cb2c by Miss Islington (bot) 
(Jürgen Gmach) in branch 'master':
bpo-38914 Do not require email field in setup.py. (GH-17388)
https://github.com/python/cpython/commit/9f9dac0a4e58d5c72aa3b644701cb155c009cb2c


--
nosy: +miss-islington

___
Python tracker 

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



[issue39121] gzip header write OS field

2019-12-23 Thread Rob Man


Rob Man  added the comment:

I do not need it for personaly, but since RFC exists and since linux
command line equivalent writes OS information, why should python gzip
implementation not include that.
The same goes for the FCOMMENT field for wich I also have a patch ready and
I they're both nice enhancements.

On Mon, 23 Dec 2019 at 09:04, Serhiy Storchaka 
wrote:

>
> Serhiy Storchaka  added the comment:
>
> The OS field is used in determining end-of-line convention for text files.
> But since we do not set the FTEXT flag, all files are binary. RFC 1952
>
> Why do you need to set this field?
>
> --
> nosy: +serhiy.storchaka
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue20905] Adapt heapq push/pop/replace to allow passing a comparator.

2019-12-23 Thread Mark Dickinson


Mark Dickinson  added the comment:

Michael: if you want to take this further, your best bet would probably be to 
start a discussion on the python-ideas mailing list 
(https://mail.python.org/mailman3/lists/python-ideas.python.org/).

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue39124] round Decimal error

2019-12-23 Thread Mark Dickinson


Mark Dickinson  added the comment:

More details on the change here:  
https://docs.python.org/3/whatsnew/3.0.html#builtins

and in the library documentation:
https://docs.python.org/3/library/functions.html#round

--

___
Python tracker 

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



[issue39124] round Decimal error

2019-12-23 Thread Mark Dickinson


Mark Dickinson  added the comment:

In Python 3, the rounding mode is round-ties-to-even. (In Python 2, it's 
round-ties-to-away.)

--
nosy: +mark.dickinson
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



[issue39124] round Decimal error

2019-12-23 Thread Adelson Luiz de Lima


New submission from Adelson Luiz de Lima :

When I round this: round(Decimal('9.925'), 2), in Python 3.7.5 the result is 
Decimal('9.92'), but in Python 2.7.17 is 9.93

--
messages: 358814
nosy: adelsonllima
priority: normal
severity: normal
status: open
title: round Decimal error
type: crash
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



[issue39123] PyThread_xxx() not available when using limited API

2019-12-23 Thread Vadim Zeitlin


New submission from Vadim Zeitlin :

These functions (e.g. PyThread_allocate_lock() etc) are not declared inside

#if !defined(Py_LIMITED_API)

in pythread.h, yet they're not exported from python3.lib.

IMHO, ideal would be to just provide these functions in the library, as they 
exist since basically always, but if the intention is to not make them part of 
the limited API, a guard around their declarations in the header should be 
added so that using them at least results in link-time errors instead of 
compile-time ones when using limited API.

--
components: C API
messages: 358813
nosy: VZ
priority: normal
severity: normal
status: open
title: PyThread_xxx() not available when using limited API
type: enhancement
versions: Python 3.8

___
Python tracker 

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



[issue39115] Clarify Python MIME type

2019-12-23 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

If you are not talking about IANA registration (I doubt if Python needs it) 
what do you propose?
I've missed what do you want to update in Python or its docs to satisfy your 
needs.

--

___
Python tracker 

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



[issue39115] Clarify Python MIME type

2019-12-23 Thread Josh de Kock


Josh de Kock  added the comment:

An IANA media type assignment would be even better than a '*/x-*' MIME, of 
course, but my original intention was just to clarify that the MIMEs in the 
cpython source can be used as documentation for 'which MIME should you use when 
sending .py,.pyc,.pyo'. 

I'm unsure if Python is eligible for a 'real' assignment, as far as I can tell, 
the main factor is if they are willing to take a reference implementation as 'a 
permanent and readily available public specification of the format for the 
media type' [1].

[1]: https://tools.ietf.org/html/rfc6838#section-4.4

--

___
Python tracker 

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



[issue38878] os.PathLike subclasshook causes subclass checks true on abstract implementation

2019-12-23 Thread Bar Harel


Change by Bar Harel :


--
pull_requests: +17142
pull_request: https://github.com/python/cpython/pull/17685

___
Python tracker 

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



[issue38878] os.PathLike subclasshook causes subclass checks true on abstract implementation

2019-12-23 Thread Bar Harel


Change by Bar Harel :


--
pull_requests: +17141
pull_request: https://github.com/python/cpython/pull/17684

___
Python tracker 

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



[issue39115] Clarify Python MIME type

2019-12-23 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Do you mean adding a record to 
https://www.iana.org/assignments/media-types/media-types.xhtml?

--
nosy: +asvetlov

___
Python tracker 

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



[issue39112] Misleading documentation for tuple

2019-12-23 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

FWIW, built-in types page has the class prefix : 
https://docs.python.org/3/library/stdtypes.html#tuple . Similar difference 
between range in the two pages.

--
nosy: +xtreak

___
Python tracker 

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



[issue39087] [C API] No efficient C API to get UTF-8 string from unicode object.

2019-12-23 Thread Inada Naoki


Change by Inada Naoki :


--
pull_requests: +17140
pull_request: https://github.com/python/cpython/pull/17683

___
Python tracker 

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



[issue39122] Environment variable PYTHONUSERBASE is not set during customized Python Installation

2019-12-23 Thread Sara Martínez Giner

New submission from Sara Martínez Giner :

Environment variable PYTHONUSERBASE is not set during customized Python 
Installation.

Python installer 3.7.6(x64) / Windows 10

Check 1: Customize the installation to install Python in C:\Python37 for all 
users. 
  Result: Access Denied using pip

Check 2: Check 1: Customize the installation to install Python in C:\Program 
Files\Python37 for all users (default). 
  Result: pip works, but error appears trying to install anything with pip. For 
example:
>>pip install virtualenv
 WARNING: The script virtualenv.exe is intalled in 
'C:\Users\XXX\AppData\Roaming\Python\Python37\Scripts' which is not on path

By default APPDATA matches with C:\Users\XXX\AppData\Roaming
and PYHTONUSERBASE is empty

-

I've found the path constructor in \Python37\Lib\site.py (_getuserbase)

So I try the following steps:
- Create folder with full control in C:\ (C:\Python)
- Set environment variable PYTHONUSERBASE=C:\Python
- Install Python for all users in C:\Python\Python37

That works for me.

--
components: Windows
messages: 358808
nosy: paul.moore, sarmar11, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Environment variable PYTHONUSERBASE is not set during customized Python 
Installation
type: security
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



[issue39117] Performance regression for making bound methods

2019-12-23 Thread Inada Naoki


Inada Naoki  added the comment:

Is this regression is large enough to revive the free_list for bound methods?

--

___
Python tracker 

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



[issue39117] Performance regression for making bound methods

2019-12-23 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +inada.naoki, serhiy.storchaka

___
Python tracker 

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



[issue32780] ctypes: memoryview gives incorrect PEP3118 format strings for both packed and unpacked structs

2019-12-23 Thread mattip


mattip  added the comment:

Is there a ctypes or PEP-3118 core-dev who could review the issue and the PR 
solution?

--
nosy: +mattip

___
Python tracker 

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



[issue39121] gzip header write OS field

2019-12-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The OS field is used in determining end-of-line convention for text files. But 
since we do not set the FTEXT flag, all files are binary. RFC 1952

Why do you need to set this field?

--
nosy: +serhiy.storchaka

___
Python tracker 

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