[issue35711] Print information about an unexpectedly pending error before crashing

2019-01-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Calling PyErr_Occurred() on every function call adds some overhead. It should 
be called only in the debug build.

In addition to the traceback, it would be nice to output also some information 
about the callable.

Note also that PyErr_Print() calls sys.excepthook and exits the interpreter if 
SystemExit is raised. It is not a proper function for using here.

--
components: +Interpreter Core
nosy: +serhiy.storchaka, vstinner
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



[issue35714] Document that the null character '\0' terminates a struct format spec

2019-01-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I think the null character is illegal character in the format string, and 
struct functions should raise a struct.error for it.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue35712] Make NotImplemented unusable in boolean context

2019-01-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

This is a common mistake. Even the default implementation of object.__ne__ had 
a bug, fixed only 4 years ago in issue21408. There were several errors in 
stdlib. I am sure there is a lot of occurrences of this errors in a third party 
code.

So I like this idea. This can help to fix hidden errors in existing code. But I 
share also Josh's concerns.

There is related common mistake. In C code, the result of PyObject_IsTrue() 
often is treated as just a boolean, without checking for errors. Fortunately, 
in the current CPython code it is handled properly, but I am sure this error 
still is occurred in third-party extensions.

When these two errors (using NotImplemented in the boolean context and ignoring 
the error in PyObject_IsTrue() in the C code) meet, this can lead to 
manifestation of more weird bugs than treating NotImplemented as true: from a 
crash in debug build to raising an exception in the following unrelated code.

I suggest to start emitting a DeprecationWarning or a FutureWarning in 
NotImplemented.__bool__.

--
nosy: +gvanrossum, serhiy.storchaka

___
Python tracker 

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



[issue35693] test_httpservers fails

2019-01-10 Thread Steve Dower


Steve Dower  added the comment:

> It is true that I worry about failing tests during PGO training because they 
> stop me from compiling Python -with- PGO.

They shouldn't prevent you from compiling with PGO... even if they cause Python 
to crash, you should be able to compile still. How is it failing? Do you not 
get binaries in the output folder at the end? What error messages do you see?

In any case, the httpservers failures seem to recur for you on 3.7, but not 
anyone else, which means we need your help diagnosing that issue. Could you 
start by getting the latest 3.7 sources, run "PCbuild/build.bat -p x64" and 
then your rt.bat command and post the complete output?

--
stage: resolved -> test needed
status: closed -> open
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



[issue35157] Missing pyconfig.h when building from source and pgo flag is enabled

2019-01-10 Thread Jorge Ramos


Change by Jorge Ramos :


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



[issue35156] Consider revising documentation on Python Builds from source

2019-01-10 Thread Jorge Ramos


Change by Jorge Ramos :


--
stage: needs patch -> 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



[issue35693] test_httpservers fails

2019-01-10 Thread Zachary Ware


Zachary Ware  added the comment:

Test failures during the PGO training (*not* those after the final PGO 
compilation) should be ignored; if they're not, that's an issue that should be 
fixed.

--

___
Python tracker 

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



[issue35399] Sysconfig bug

2019-01-10 Thread Jorge Ramos


Change by Jorge Ramos :


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



[issue35400] PGOMGR : warning PG0188:

2019-01-10 Thread Jorge Ramos


Change by Jorge Ramos :


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



[issue35693] test_httpservers fails

2019-01-10 Thread Jorge Ramos


Change by Jorge Ramos :


--
stage: test needed -> resolved
status: open -> closed

___
Python tracker 

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



[issue35693] test_httpservers fails

2019-01-10 Thread Jorge Ramos


Jorge Ramos  added the comment:

It is true that I worry about failing tests during PGO training because they 
stop me from compiling Python -with- PGO. I also got here to report my 
experience and problems back to you guys but, if the problems are known, well, 
there's nothing much I can do then. Also, I know this isn't a platform for 
asking howto questions so I will not bother you guys with that either. I 
*could* get back to topic and try to help sorting out the test_httpservers 
(because they do fail on 3.7, at least on my side) but it seems I don't have 
the necessary experience to give any meaningful aid. There's a saying in my 
hometown which goes something like this: "the one that does not hinder, helps", 
so that's what I'll do. happy coding!

--

___
Python tracker 

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



[issue35693] test_httpservers fails

2019-01-10 Thread Steve Dower


Steve Dower  added the comment:

Defining new training sets for PGO would be a new job (that you could volunteer 
to do if you like). The test suite is convenient because when you clone our 
GitHub repository, it's already there. Another training suite would have to be 
installed somehow as part of build (like we already do for extra tools).

The layouts are how Python looks when installed. Currently they are not 
documented, as they are subject to change (within reason - python.exe has to 
continue working from the root of any install), but the script in the PC/layout 
directory can produce them all with different options.

It sounds like these jobs may be more than you want to do. If you are just 
worried about failing tests during PGO training, then stop worrying because 
they are known and okay. Provided they pass when Python is installed properly 
(using our primary installer), there is no problem, and it sounds like this is 
the case.

--

___
Python tracker 

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



[issue35661] Store the venv prompt in pyvenv.cfg

2019-01-10 Thread Steve Dower


Steve Dower  added the comment:

Your tests actually went the other way. This one puts a trailing space after 
the prompt and expected it to be there in the file, but also ensured that 
exactly one space was added at the start.

self.assertEqual(context.prompt, '(My prompt) ')
builder.create(self.env_dir)
data = self.get_text_file_contents('pyvenv.cfg')
self.assertIn('prompt = (My prompt) \n', data)

In the line "prompt = (My prompt) ", we need to define which of the spaces at 
either end of the value should be retained by tools trying to use the same 
prompt. The obvious assumption is to strip both ends, which would break your 
test. The next most obvious is to quote the string value (e.g. write 
repr(context.prompt) instead of the prompt directly).

Also, I'm pretty sure I saw some advice once to use multiple lines worth of 
prompt, which probably breaks many shells but presumably works okay in Bash. 
You'll need to handle that case as well - again, repr() will do it naturally by 
encoding newlines an "\n".

Anyone reading the string will have to do the equivalent of Python's 
literal_eval(), but that's pretty manageable in exchange for avoiding a whole 
lot of edge cases.

--

___
Python tracker 

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



[issue34628] urllib.request.urlopen fails when userinfo is present in URL

2019-01-10 Thread Windson Yang


Windson Yang  added the comment:

I found that Requests library use urllib3 library which looks like ignore the 
user info part (in request_context 
https://github.com/urllib3/urllib3/blob/master/src/urllib3/poolmanager.py#L208).
 Did I miss something or we should also ignore it?

--

___
Python tracker 

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



[issue35712] Make NotImplemented unusable in boolean context

2019-01-10 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

> the canonical __ne__ delegation to __eq__ for any class should be implemented 
> as something like

I disagree that your code snippet is the canonical way to write __ne__. I'd 
write it like this:

def __ne__(self, other):
return not (self == other)

Or just not write it at all. Python will automatically call __eq__ going back 
to Python 2.4 (and possibly older).

Delegating to __eq__ directly is the wrong way to do it.

> NotImplemented is a sentinel value that should never be evaluated in a 
> boolean context

I don't see why not. I can't think of any use-cases where I would want to 
*specifically* use NotImplemented in a boolean context, but I see no good 
reason why I would want it to fail if one happened to do so.

--
nosy: +steven.daprano

___
Python tracker 

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



[issue32146] multiprocessing freeze_support needed outside win32

2019-01-10 Thread bbayles


bbayles  added the comment:

Thanks for the note. I've merged in master and fixed a conflict in the test 
file.

In an earlier rev I tried to do the argument parsing without ast.literal_eval, 
but found it awkward to support all the ways [1] can manifest. You might have a 
better idea?


[1] 
https://github.com/python/cpython/blob/3.7/Lib/multiprocessing/forkserver.py#L106-L107

--

___
Python tracker 

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



[issue24746] doctest 'fancy diff' formats incorrectly strip trailing whitespace

2019-01-10 Thread Senthil Kumaran


Senthil Kumaran  added the comment:

All changes related to this issue are done.

Thanks for your contribution and engagement everyone!

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



[issue35714] Document that the null character '\0' terminates a struct format spec

2019-01-10 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

I'm not sure whether having NULLs terminate a struct format string is a feature 
or a bug.

Given that nearly every other string in Python treat NULLs as ordinary 
characters, I'm inclined to say this is a bug. Or at least an unnecessary 
restriction that ought to be lifted.

--
nosy: +steven.daprano
type:  -> behavior

___
Python tracker 

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



[issue35713] Fatal Python error: _PySys_BeginInit: can't initialize sys module

2019-01-10 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Please attach the full build log too along with the command executed.

--
nosy: +xtreak

___
Python tracker 

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



[issue35713] Fatal Python error: _PySys_BeginInit: can't initialize sys module

2019-01-10 Thread STINNER Victor


STINNER Victor  added the comment:

Because it's late, I will say it shortly: if you don't elaborate how you get 
this error, I will simply close the issue. You have to describe what you are 
trying to do, your OS, etc.

(It works for me!)

--

___
Python tracker 

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



[issue35713] Fatal Python error: _PySys_BeginInit: can't initialize sys module

2019-01-10 Thread Tasy


Tasy  added the comment:

Sorry for the confusion. The three dots were for many lines of successful 
compilation output from make. The rest is the final few lines where the 
compilation fails.

--

___
Python tracker 

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



[issue35712] Make NotImplemented unusable in boolean context

2019-01-10 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Seems related issue22978

--
nosy: +xtreak

___
Python tracker 

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



[issue35713] Fatal Python error: _PySys_BeginInit: can't initialize sys module

2019-01-10 Thread STINNER Victor


STINNER Victor  added the comment:

> .
> .
> .

Hello. Can you elaborate this part?

--
nosy: +vstinner

___
Python tracker 

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



[issue35714] Document that the null character '\0' terminates a struct format spec

2019-01-10 Thread Dan Snider


New submission from Dan Snider :

ie.:
>>> from struct import calcsize
>>> calcsize('\144\u0064\000xf\U0031000\60d\121\U0051')
16

I'm sure some people think it's obvious or even expect the null character to 
signal EOF but it probably isn't obvious at all to those without experience in 
lower level languages. It actually seems like Python goes out of its way to 
make sure everything treats the null character no more special than the letter 
"H", which is good.

At first glance I'd think something like this was just another trivial quirk of 
the language and not bring it up, but because the documentation doesn't mention 
it I actually got stuck on something related for half an hour when unit testing 
some dynamically generated format specs. 

Without going into unnecessary detail, what happened was that a typo in another 
tangentially related part of the test was enabling the generation of a rogue 
null byte. I'm bad at those "find face in the crowd" puzzles and this was 
hardly different, being literally camouflaged within a 300 character format 
spec containing a random mixture of escaped and non-escaped source characters 
in the forms: \U, \u, \777, \xff, \x00, + latin/ascii.

If I'm not the only one who sees this as a slightly bigger deal than poor 
documentation, the fix is trivial with an extra call to PyBytes_GET_SIZE when 
null is found. But just because I can't think of a use case in allowing the 
null character to precede other characters in the format string doesn't mean 
there isn't one, which is why only documentation is currently selected.

--
assignee: docs@python
components: Documentation, Library (Lib)
messages: 333424
nosy: bup, docs@python
priority: normal
severity: normal
status: open
title: Document that the null character '\0' terminates a struct format spec
versions: Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue35713] Fatal Python error: _PySys_BeginInit: can't initialize sys module

2019-01-10 Thread Tasy


New submission from Tasy :

.
.
.
./python -E -S -m sysconfig --generate-posix-vars ;\
if test $? -ne 0 ; then \
echo "generate-posix-vars failed" ; \
rm -f ./pybuilddir.txt ; \
exit 1 ; \
fi
Fatal Python error: _PySys_BeginInit: can't initialize sys module

Current thread 0x2b4e5f9bf400 (most recent call first):
Aborted (core dumped)
generate-posix-vars failed
make[1]: *** [pybuilddir.txt] Error 1
make[1]: Leaving directory `/usr/local/mysoftware/Python-3.7.2/build'
make: *** [profile-opt] Error 2

--
components: Build
messages: 333423
nosy: Tasy
priority: normal
severity: normal
status: open
title: Fatal Python error: _PySys_BeginInit: can't initialize sys module
type: compile error
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



[issue26239] distutils link-objects is not normalized

2019-01-10 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

This was fixed in issue 1703178.

--
nosy: +cheryl.sabella
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> link_objects in setup.cfg crashes build

___
Python tracker 

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



[issue35712] Make NotImplemented unusable in boolean context

2019-01-10 Thread Josh Rosenberg


New submission from Josh Rosenberg :

I don't really expect this to go anywhere until Python 4 (*maybe* 3.9 after a 
deprecation period), but it seems like it would have been a good idea to make 
NotImplementedType's __bool__ explicitly raise a TypeError (rather than leaving 
it unset, so NotImplemented evaluates as truthy). Any correct use of 
NotImplemented per its documented intent would never evaluate it in a boolean 
context, but rather use identity testing, e.g. back in the Py2 days, the 
canonical __ne__ delegation to __eq__ for any class should be implemented as 
something like:

def __ne__(self, other):
equal = self.__eq__(other)
return equal if equal is NotImplemented else not equal

Problem is, a lot of folks would make mistakes like doing:

def __ne__(self, other):
return not self.__eq__(other)

which silently returns False when __eq__ returns NotImplemented, rather than 
returning NotImplemented and allowing Python to check the mirrored operation. 
Similar issues arise when hand-writing the other rich comparison operators in 
terms of each other.

It seems like, given NotImplemented is a sentinel value that should never be 
evaluated in a boolean context, at some point it might be nice to explicitly 
prevent it, to avoid errors like this.

Main argument against it is that I don't know of any other type/object that 
explicitly makes itself unevaluable in a boolean context, so this could be 
surprising if someone uses NotImplemented as a sentinel unrelated to its 
intended purpose and suffers the problem.

--
messages: 333421
nosy: josh.r
priority: normal
severity: normal
status: open
title: Make NotImplemented unusable in boolean context
type: behavior

___
Python tracker 

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



[issue35656] More matchers in unittest.mock

2019-01-10 Thread Lisa Roach


Lisa Roach  added the comment:

APPROXIMATE feels like it might lead to code smell to me, if I know roughly 
what the float should be why would I not want to test it for exactness? It 
could end up hiding inconsistencies the tests should be catching.

--
nosy: +lisroach

___
Python tracker 

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



[issue2517] Error when printing an exception containing a Unicode string

2019-01-10 Thread Piotr Dobrogost

Piotr Dobrogost  added the comment:

Benjamin Peterson in comment https://bugs.python.org/issue2517#msg64771 wrote:

"That is because Python encodes it's error messages as ASCII by default…"

Could somebody please point where in the source code of Python 2 this happens?

--

___
Python tracker 

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



[issue35711] Print information about an unexpectedly pending error before crashing

2019-01-10 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch, patch
pull_requests: +11071, 11072
stage:  -> patch review

___
Python tracker 

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



[issue35711] Print information about an unexpectedly pending error before crashing

2019-01-10 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch, patch, patch
pull_requests: +11071, 11072, 11073
stage:  -> patch review

___
Python tracker 

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



[issue35711] Print information about an unexpectedly pending error before crashing

2019-01-10 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
pull_requests: +11071
stage:  -> patch review

___
Python tracker 

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



[issue35711] Print information about an unexpectedly pending error before crashing

2019-01-10 Thread Samuel Freilich


New submission from Samuel Freilich :

_PyObject_FastCallDict and _PyObject_FastCallKeywords assert that there is no 
pending exception before calling functions that might otherwise clobber the 
exception state. However, that doesn't produce very clear output for debugging, 
since the assert failure doesn't say anything about what the pending exception 
actually was. It would be better to print the pending exception first.

--
messages: 333418
nosy: Samuel Freilich
priority: normal
severity: normal
status: open
title: Print information about an unexpectedly pending error before crashing

___
Python tracker 

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



[issue24746] doctest 'fancy diff' formats incorrectly strip trailing whitespace

2019-01-10 Thread Senthil Kumaran


Senthil Kumaran  added the comment:


New changeset 0167c08163f44f4a033497102244bbb6150f606b by Senthil Kumaran in 
branch '2.7':
bpo-24746: Fix doctest failures when running the testsuite with -R (#11501) 
(#11512)
https://github.com/python/cpython/commit/0167c08163f44f4a033497102244bbb6150f606b


--

___
Python tracker 

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



[issue35710] Make dataclasses.field() accept another name for __init__ field's name

2019-01-10 Thread Eric V. Smith


Change by Eric V. Smith :


--
assignee:  -> eric.smith
nosy: +eric.smith
type:  -> enhancement

___
Python tracker 

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



[issue35707] time.sleep() should support objects with __float__

2019-01-10 Thread Jeroen Demeyer


Jeroen Demeyer  added the comment:

> I'm not sure in which order the conversion should be tried to avoid/reduce 
> precision loss during the conversion.

I would suggest the order

1. __index__ to ensure exact conversion of exact integers
2. __float__ to ensure correct conversion of floating-point numbers
3. __int__

--

___
Python tracker 

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



[issue24746] doctest 'fancy diff' formats incorrectly strip trailing whitespace

2019-01-10 Thread Ned Deily


Ned Deily  added the comment:


New changeset d09e8cecf214b1de457feae01860f5592f912a8e by Ned Deily (Senthil 
Kumaran) in branch '3.6':
Revert "bpo-24746: Avoid stripping trailing whitespace in doctest fancy diff 
(GH-10639) (GH-11477)" (GH-11509)
https://github.com/python/cpython/commit/d09e8cecf214b1de457feae01860f5592f912a8e


--
nosy: +ned.deily

___
Python tracker 

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



[issue32146] multiprocessing freeze_support needed outside win32

2019-01-10 Thread miss-islington


miss-islington  added the comment:


New changeset b9cd38f928f7eb4e18ad4b63e5c49c05c626c33e by Miss Islington (bot) 
in branch '3.7':
bpo-32146: Add documentation about frozen executables on Unix (GH-5850)
https://github.com/python/cpython/commit/b9cd38f928f7eb4e18ad4b63e5c49c05c626c33e


--
nosy: +miss-islington

___
Python tracker 

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



[issue24746] doctest 'fancy diff' formats incorrectly strip trailing whitespace

2019-01-10 Thread Senthil Kumaran


Change by Senthil Kumaran :


--
versions: +Python 2.7

___
Python tracker 

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



[issue24746] doctest 'fancy diff' formats incorrectly strip trailing whitespace

2019-01-10 Thread Senthil Kumaran


Change by Senthil Kumaran :


--
pull_requests: +11067, 11068, 11070

___
Python tracker 

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



[issue24746] doctest 'fancy diff' formats incorrectly strip trailing whitespace

2019-01-10 Thread Senthil Kumaran


Change by Senthil Kumaran :


--
pull_requests: +11067, 11068

___
Python tracker 

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



[issue24746] doctest 'fancy diff' formats incorrectly strip trailing whitespace

2019-01-10 Thread Senthil Kumaran


Change by Senthil Kumaran :


--
pull_requests: +11067, 11068, 11069, 11070

___
Python tracker 

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



[issue24746] doctest 'fancy diff' formats incorrectly strip trailing whitespace

2019-01-10 Thread Senthil Kumaran


Change by Senthil Kumaran :


--
pull_requests: +11067

___
Python tracker 

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



[issue35702] clock_gettime: Add new identifier CLOCK_UPTIME_RAW for Darwin

2019-01-10 Thread Ricardo Fraile


Ricardo Fraile  added the comment:

Impressive response time, thanks team!

--

___
Python tracker 

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



[issue35698] Division by 2 in statistics.median

2019-01-10 Thread Brett Cannon


Change by Brett Cannon :


--
nosy: +steven.daprano

___
Python tracker 

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



[issue35698] [statistics] Division by 2 in statistics.median

2019-01-10 Thread Brett Cannon


Change by Brett Cannon :


--
title: Division by 2 in statistics.median -> [statistics] Division by 2 in 
statistics.median

___
Python tracker 

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



[issue35701] [uuid] 3.8 breaks weak references for UUIDs

2019-01-10 Thread Brett Cannon


Change by Brett Cannon :


--
title: 3.8 needlessly breaks weak references for UUIDs -> [uuid] 3.8 breaks 
weak references for UUIDs

___
Python tracker 

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



[issue32146] multiprocessing freeze_support needed outside win32

2019-01-10 Thread miss-islington


Change by miss-islington :


--
pull_requests: +11064, 11065, 11066

___
Python tracker 

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



[issue32146] multiprocessing freeze_support needed outside win32

2019-01-10 Thread miss-islington


Change by miss-islington :


--
pull_requests: +11064, 11065

___
Python tracker 

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



[issue32146] multiprocessing freeze_support needed outside win32

2019-01-10 Thread miss-islington


Change by miss-islington :


--
pull_requests: +11064

___
Python tracker 

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



[issue32146] multiprocessing freeze_support needed outside win32

2019-01-10 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset bab4bbb4c9cd5d25ede21a1b8c99d56e3b8dae9d by Victor Stinner (Bo 
Bayles) in branch 'master':
bpo-32146: Add documentation about frozen executables on Unix (GH-5850)
https://github.com/python/cpython/commit/bab4bbb4c9cd5d25ede21a1b8c99d56e3b8dae9d


--
nosy: +vstinner

___
Python tracker 

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



[issue32146] multiprocessing freeze_support needed outside win32

2019-01-10 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

I'm sorry about not seeing your PR before.  Would you like to update it against 
current git master?

(note I'm not thrilled by the use of the "ast" module; I hope we can change the 
command-line args so that this isn't needed)

--

___
Python tracker 

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



[issue35045] test_min_max_version (test.test_ssl.ContextTests) fails on Fedora 29+ and openssl 1.1.1

2019-01-10 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +11061, 11062

___
Python tracker 

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



[issue35045] test_min_max_version (test.test_ssl.ContextTests) fails on Fedora 29+ and openssl 1.1.1

2019-01-10 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +11061

___
Python tracker 

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



[issue35045] test_min_max_version (test.test_ssl.ContextTests) fails on Fedora 29+ and openssl 1.1.1

2019-01-10 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +11061, 11062, 11063

___
Python tracker 

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



[issue24746] doctest 'fancy diff' formats incorrectly strip trailing whitespace

2019-01-10 Thread Senthil Kumaran


Change by Senthil Kumaran :


--
pull_requests: +11058, 11059, 11060

___
Python tracker 

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



[issue24746] doctest 'fancy diff' formats incorrectly strip trailing whitespace

2019-01-10 Thread Senthil Kumaran


Change by Senthil Kumaran :


--
pull_requests: +11058, 11059

___
Python tracker 

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



[issue24746] doctest 'fancy diff' formats incorrectly strip trailing whitespace

2019-01-10 Thread Senthil Kumaran


Change by Senthil Kumaran :


--
pull_requests: +11058

___
Python tracker 

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



[issue35698] Division by 2 in statistics.median

2019-01-10 Thread Jonathan Fine

Jonathan Fine  added the comment:

It might be better in my sample code to write
isinstance(p, int)
instead of
type(p) == int
This would fix Rémi's example. (I wanted to avoid thinking about (False // 
True).)

For median([1, 1]), I am not claiming that 1.0 is wrong and 1 is right. I'm not 
saying the module is broken, only that it can be improved.

For median([1, 1]), I believe that 1 is a better answer, particularly for 
school students. In other words, that making this change would improve Python.

As a pure mathematician, to me 1.0 means a number that is close to 1. Whereas 1 
means a number that is exactly 1..

--

___
Python tracker 

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



[issue35045] test_min_max_version (test.test_ssl.ContextTests) fails on Fedora 29+ and openssl 1.1.1

2019-01-10 Thread STINNER Victor


Change by STINNER Victor :


--
keywords: +patch, patch, patch
pull_requests: +11055, 11056, 11057
stage:  -> patch review

___
Python tracker 

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



[issue35045] test_min_max_version (test.test_ssl.ContextTests) fails on Fedora 29+ and openssl 1.1.1

2019-01-10 Thread STINNER Victor


Change by STINNER Victor :


--
keywords: +patch, patch
pull_requests: +11055, 11056
stage:  -> patch review

___
Python tracker 

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



[issue35710] Make dataclasses.field() accept another name for __init__ field's name

2019-01-10 Thread Rémi Lapeyre

New submission from Rémi Lapeyre :

When creating a class, I sometimes wish to get this behavior:


def MyClass:
def __init__(self, param):
self._param = param

def __repr__(self):
return f"MyClass(param={self._param})"


Unless I'm making a mistaking, this behavior is not currently possible with 
dataclasses.

I propose to change:

field(*, default=MISSING, default_factory=MISSING, repr=True, hash=None, 
init=True, compare=True, metadata=None)

to: 

field(*, default=MISSING, default_factory=MISSING, repr=True, hash=None, 
init=True, compare=True, metadata=None, target=None)

with target being used as the init parameter name for this field and in the 
repr.

If this is accepted, I can post the patch to make this change.

--
messages: 333409
nosy: remi.lapeyre
priority: normal
severity: normal
status: open
title: Make dataclasses.field() accept another name for __init__ field's name
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



[issue35045] test_min_max_version (test.test_ssl.ContextTests) fails on Fedora 29+ and openssl 1.1.1

2019-01-10 Thread STINNER Victor


Change by STINNER Victor :


--
keywords: +patch
pull_requests: +11055
stage:  -> patch review

___
Python tracker 

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



[issue35045] test_min_max_version (test.test_ssl.ContextTests) fails on Fedora 29+ and openssl 1.1.1

2019-01-10 Thread STINNER Victor


Change by STINNER Victor :


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



[issue35709] test_ssl fails on Fedora 29: test_min_max_version()

2019-01-10 Thread STINNER Victor


STINNER Victor  added the comment:

Oh right, it's a duplicate of bpo-35045.

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> test_min_max_version (test.test_ssl.ContextTests) fails on 
Fedora 29+ and openssl 1.1.1

___
Python tracker 

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



[issue35709] test_ssl fails on Fedora 29: test_min_max_version()

2019-01-10 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Seems related https://bugs.python.org/issue35045

--
nosy: +xtreak

___
Python tracker 

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



[issue35702] clock_gettime: Add new identifier CLOCK_UPTIME_RAW for Darwin

2019-01-10 Thread STINNER Victor


STINNER Victor  added the comment:

Joannah Nanjekye added time.CLOCK_UPTIME_RAW to the master branch (future 
Python 3.8). We don't add feature to stable versions (like 3.7), so I close the 
issue.

Thanks Ricardo Fraile for the report, I wasn't aware of this clock ;-)

Note: Until Python 3.8 is released, you can easily hardcode the constant in 
your application. Such constant rarely change.

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



[issue35702] clock_gettime: Add new identifier CLOCK_UPTIME_RAW for Darwin

2019-01-10 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 572168a016ece1b7346695eb7289190c46f1ae55 by Victor Stinner 
(Joannah Nanjekye) in branch 'master':
bpo-35702: Add new identifier time.CLOCK_UPTIME_RAW for macOS 10.12 (GH-11503)
https://github.com/python/cpython/commit/572168a016ece1b7346695eb7289190c46f1ae55


--

___
Python tracker 

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



[issue35707] time.sleep() should support objects with __float__

2019-01-10 Thread STINNER Victor


STINNER Victor  added the comment:

PR 11507 is not directly related to this issue, see bpo-26669. But I wrote this 
PR when trying to fix this issue :-)

--

___
Python tracker 

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



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

2019-01-10 Thread STINNER Victor


STINNER Victor  added the comment:

I wrote PR 11507 to raise ValueError rather than OverflowError for -inf and 
+inf.

--

___
Python tracker 

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



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

2019-01-10 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +11049, 11050, 11051
stage: backport needed -> patch review

___
Python tracker 

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



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

2019-01-10 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +11049, 11050, 11051, 11052
stage: backport needed -> patch review

___
Python tracker 

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



[issue35707] time.sleep() should support objects with __float__

2019-01-10 Thread STINNER Victor


Change by STINNER Victor :


--
keywords: +patch, patch
pull_requests: +11053, 11054
stage:  -> patch review

___
Python tracker 

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



[issue35707] time.sleep() should support objects with __float__

2019-01-10 Thread STINNER Victor


Change by STINNER Victor :


--
keywords: +patch
pull_requests: +11053
stage:  -> patch review

___
Python tracker 

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



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

2019-01-10 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +11049, 11050
stage: backport needed -> patch review

___
Python tracker 

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



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

2019-01-10 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +11049
stage: backport needed -> patch review

___
Python tracker 

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



[issue35709] test_ssl fails on Fedora 29: test_min_max_version()

2019-01-10 Thread STINNER Victor


New submission from STINNER Victor :

test_ssl fails on Fedora 29:

vstinner@apu$ ./python -m test test_ssl -m test_min_max_version -v
== CPython 3.8.0a0 (heads/pytime_inf:aaea5b25d1, Jan 10 2019, 17:40:16) [GCC 
8.2.1 20181215 (Red Hat 8.2.1-6)]
== Linux-4.19.13-300.fc29.x86_64-x86_64-with-glibc2.28 little-endian
== cwd: /home/vstinner/prog/python/master/build/test_python_26069
== CPU count: 8
== encodings: locale=UTF-8, FS=utf-8
Run tests sequentially
0:00:00 load avg: 2.33 [1/1] test_ssl
test_ssl: testing with 'OpenSSL 1.1.1 FIPS  11 Sep 2018' (1, 1, 1, 0, 15)
  under 'Linux-4.19.13-300.fc29.x86_64-x86_64-with-glibc2.28'
  HAS_SNI = True
  OP_ALL = 0x8054
  OP_NO_TLSv1_1 = 0x1000
test_min_max_version (test.test_ssl.ContextTests) ... FAIL
test_min_max_version (test.test_ssl.ThreadedTests) ...  server:  new connection 
from ('127.0.0.1', 35268)
 server: connection cipher is now ('ECDHE-RSA-AES256-GCM-SHA384', 'TLSv1.2', 
256)
 server: selected protocol is now None
 server:  new connection from ('127.0.0.1', 40390)
 server: connection cipher is now ('ECDHE-RSA-AES256-SHA', 'TLSv1.0', 256)
 server: selected protocol is now None
 server:  new connection from ('127.0.0.1', 36674)

 server:  bad connection attempt from ('127.0.0.1', 36674):
Traceback (most recent call last):
   File "/home/vstinner/prog/python/master/Lib/test/test_ssl.py", line 2150, in 
wrap_conn
self.sslconn = self.server.context.wrap_socket(
   File "/home/vstinner/prog/python/master/Lib/ssl.py", line 405, in wrap_socket
return self.sslsocket_class._create(
   File "/home/vstinner/prog/python/master/Lib/ssl.py", line 853, in _create
self.do_handshake()
   File "/home/vstinner/prog/python/master/Lib/ssl.py", line 1117, in 
do_handshake
self._sslobj.do_handshake()
 ssl.SSLError: [SSL: UNSUPPORTED_PROTOCOL] unsupported protocol (_ssl.c:1055)
ok

==
FAIL: test_min_max_version (test.test_ssl.ContextTests)
--
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/test/test_ssl.py", line 1069, in 
test_min_max_version
self.assertEqual(
AssertionError:  != 

--

Ran 2 tests in 0.026s

FAILED (failures=1)
test test_ssl failed
test_ssl failed

== Tests result: FAILURE ==

1 test failed:
test_ssl

Total duration: 269 ms
Tests result: FAILURE

vstinner@apu$ ./python -m test.pythoninfo|grep ^ssl
ssl.HAS_SNI: True
ssl.OPENSSL_VERSION: OpenSSL 1.1.1 FIPS  11 Sep 2018
ssl.OPENSSL_VERSION_INFO: (1, 1, 1, 0, 15)
ssl.OP_ALL: 0x8054
ssl.OP_NO_TLSv1_1: 0x1000

--
components: Tests
messages: 333402
nosy: vstinner
priority: normal
severity: normal
status: open
title: test_ssl fails on Fedora 29: test_min_max_version()
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



[issue35707] time.sleep() should support objects with __float__

2019-01-10 Thread STINNER Victor


STINNER Victor  added the comment:

The problem comes from the private C function _PyTime_FromObject() of 
Python/pytime.c. This function must use the proper conversion to minimize the 
precision loss. Lib/test/test_time.py contains a lot of tests on conversions 
from different types and ensure that values are rounded correctly. See also my 
PEP 564 "Add new time functions with nanosecond resolution".

The correct code works for float and int (and maybe decimal.Decimal, I don't 
recall!), but it seems like it doesn't support types with __float__(). You have 
to explicitly cast such objects using float(value).

PyNumber_Float() can be used to convert arbitrary object to a float, but I'm 
not sure in which order the conversion should be tried to avoid/reduce 
precision loss during the conversion.

Example:

>>> x=2**53+1; x - int(float(x))
1

If we convert 'x' (int) to float, we introduce an error of 1.

--
nosy: +vstinner

___
Python tracker 

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



[issue35470] A deadly decref in _PyImport_FindExtensionObjectEx()

2019-01-10 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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



[issue35698] Division by 2 in statistics.median

2019-01-10 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

This does not do what you want:

>>> class MyInt(int): pass
>>> wibble(MyInt(4), MyInt(2))
2.0

and a patch is only needed if something is broken.

I'm with vstinner of the opinion that nothing is broken and vote to close this 
issue.

--

___
Python tracker 

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



[issue35708] lib2to3 failed to convert as refactor's fixes not search.pyc files

2019-01-10 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue35470] A deadly decref in _PyImport_FindExtensionObjectEx()

2019-01-10 Thread miss-islington


miss-islington  added the comment:


New changeset 3e3d57d8490b729a80c8cd9e90475dec122dfe9e by Miss Islington (bot) 
in branch '3.7':
bpo-35470: Fix a reference counting bug in _PyImport_FindExtensionObjectEx(). 
(GH-11128)
https://github.com/python/cpython/commit/3e3d57d8490b729a80c8cd9e90475dec122dfe9e


--
nosy: +miss-islington

___
Python tracker 

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



[issue35698] Division by 2 in statistics.median

2019-01-10 Thread Jonathan Fine


Jonathan Fine  added the comment:

Here's the essence of a patch.

Suppose the input is Python integers, and the output is a mathematical integer. 
In this case we can make the output a Python integer by using the helper 
function

>>> def wibble(p, q):
... if type(p) == type(q) == int and p%q == 0:
... return p // q
... else:
... return p / q
... 
>>> wibble(4, 2)
2
>>> wibble(3, 2)
1.5

This will also work for average.

--

___
Python tracker 

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



[issue35707] time.sleep() should support objects with __float__

2019-01-10 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

See #33039 for the proposed change to __int__.

--

___
Python tracker 

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



[issue35707] time.sleep() should support objects with __float__

2019-01-10 Thread Rémi Lapeyre

Change by Rémi Lapeyre :


--
nosy: +ncoghlan

___
Python tracker 

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



[issue35707] time.sleep() should support objects with __float__

2019-01-10 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

time.sleep() is probably not the only function to have such a bug.

Maybe __int__() should default to:

def __int__(self):
return int(self.__float__())

when __float__ is defined and not __int__.

Nick Coghlan suggested something similar for __int__ and __index__.

--
nosy: +remi.lapeyre

___
Python tracker 

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



[issue35707] time.sleep() should support objects with __float__

2019-01-10 Thread AVINASH MISHRA


AVINASH MISHRA  added the comment:

hey i am a total newbie to open source contribution.
can you help me understand this issue and can i help solve this issue?

--
nosy: +AVINASH MISHRA

___
Python tracker 

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



[issue35470] A deadly decref in _PyImport_FindExtensionObjectEx()

2019-01-10 Thread miss-islington


Change by miss-islington :


--
pull_requests: +11047, 11048

___
Python tracker 

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



[issue35470] A deadly decref in _PyImport_FindExtensionObjectEx()

2019-01-10 Thread miss-islington


Change by miss-islington :


--
pull_requests: +11047

___
Python tracker 

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



[issue35470] A deadly decref in _PyImport_FindExtensionObjectEx()

2019-01-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 89c4f90df97f6039325e354167e8f507bf199fd9 by Serhiy Storchaka 
(Zackery Spytz) in branch 'master':
bpo-35470: Fix a reference counting bug in _PyImport_FindExtensionObjectEx(). 
(GH-11128)
https://github.com/python/cpython/commit/89c4f90df97f6039325e354167e8f507bf199fd9


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue35708] lib2to3 failed to convert as refactor's fixes not search.pyc files

2019-01-10 Thread Nj Hsiong


New submission from Nj Hsiong :

python3's lib2to3 would fail in silence if python3 and its packages are 
installed as compiled .pyc files.

Root cause is in Lib/lib2to3/refactor.py, the function get_all_fix_names only 
searches '.py' fix names.

=below is workaround=
--- a/Lib/lib2to3/refactor.py
+++ b/Lib/lib2to3/refactor.py
@@ -37,6 +37,12 @@
 if remove_prefix:
 name = name[4:]
 fix_names.append(name[:-3])
+if name.startswith("fix_") and name.endswith(".pyc"):
+if remove_prefix:
+name = name[4:]
+name = name[:-4]
+if name not in fix_names:
+fix_names.append(name)
 return fix_names

--
components: 2to3 (2.x to 3.x conversion tool)
messages: 93
nosy: njhsio
priority: normal
severity: normal
status: open
title: lib2to3 failed to convert as refactor's fixes not search.pyc files
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



[issue24746] doctest 'fancy diff' formats incorrectly strip trailing whitespace

2019-01-10 Thread miss-islington


miss-islington  added the comment:


New changeset 1cbd17c6987afc48c16caa7ccc7d19b01fbd39f2 by Miss Islington (bot) 
in branch '3.7':
bpo-24746: Fix doctest failures when running the testsuite with -R (GH-11501)
https://github.com/python/cpython/commit/1cbd17c6987afc48c16caa7ccc7d19b01fbd39f2


--

___
Python tracker 

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



[issue35707] time.sleep() should support objects with __float__

2019-01-10 Thread Jeroen Demeyer


New submission from Jeroen Demeyer :

This used to work correctly in Python 2:

class Half(object):
def __float__(self):
return 0.5
import time
time.sleep(Half())

With Python 3.6, one gets instead

Traceback (most recent call last):
  File "test.py", line 6, in 
time.sleep(Half())
TypeError: an integer is required (got type Half)

--
messages: 91
nosy: jdemeyer
priority: normal
severity: normal
status: open
title: time.sleep() should support objects with __float__
versions: Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue24746] doctest 'fancy diff' formats incorrectly strip trailing whitespace

2019-01-10 Thread STINNER Victor


STINNER Victor  added the comment:

> Finally, since the the port to 3.6 was a mistake, I will revert that.

I wrote PR 11499 but I closed it because PR #11501 has been merged, but yeah, 
maybe a revert is the best option for 3.6.

No problem, the status change of the 3.6 branch is very new, and not everybody 
got the memo ;-)
https://devguide.python.org/#status-of-python-branches

See this discussion:
https://discuss.python.org/t/remove-needs-backport-to-3-6-label/563

--

___
Python tracker 

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



[issue24746] doctest 'fancy diff' formats incorrectly strip trailing whitespace

2019-01-10 Thread Senthil Kumaran


Senthil Kumaran  added the comment:

Hi All,

It was my mistake to merge this in into 3.6, I didn't realize 3.6 was in bugfix 
mode now. Also I went by the versions (previously) set in this bpo issue.

For the regression caused in refleaks, I think, Pablo's patch will fix it, and 
I am verifying it here - https://buildbot.python.org/all/#/builders/1/builds/468

This will be backported to 3.7 ( I notice viktor triggered already: 
https://github.com/python/cpython/pull/11505) and I will cherrpick this to 2.7.

Finally, since the the port to 3.6 was a mistake, I will revert that.

This will make sure that bug is fixed all the supported versions, target 
branches tests are successful and 3.6 remains unaffected.

--
assignee: CuriousLearner -> orsenthil

___
Python tracker 

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



[issue33498] pathlib.Path wants an rmtree method

2019-01-10 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

Indeed there is no reason to put all useful path informations under the Path 
class.  Writing method calls instead of function calls is not an ideal.

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



[issue33498] pathlib.Path wants an rmtree method

2019-01-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I am against this. shutil provides higher level API than pathlib, and pathlib 
should not depend on shutil. pathlib.Path represents a path, and its methods 
usually does involve filesystem operations, or involve just a single filesystem 
operation. shutil.rmtree() is a complex operation that needs to perform several 
simple operations, and it should be together with other complex operations in 
the shutil module.

--
nosy: +giampaolo.rodola, pitrou, tarek

___
Python tracker 

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



[issue24746] doctest 'fancy diff' formats incorrectly strip trailing whitespace

2019-01-10 Thread miss-islington


Change by miss-islington :


--
pull_requests: +11044, 11045, 11046

___
Python tracker 

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



[issue24746] doctest 'fancy diff' formats incorrectly strip trailing whitespace

2019-01-10 Thread miss-islington


Change by miss-islington :


--
pull_requests: +11044, 11045

___
Python tracker 

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



[issue24746] doctest 'fancy diff' formats incorrectly strip trailing whitespace

2019-01-10 Thread miss-islington


Change by miss-islington :


--
pull_requests: +11044

___
Python tracker 

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



  1   2   >