[issue37413] Deprecate sys._enablelegacywindowsfsencoding()?

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:

One of sys._enablelegacywindowsfsencoding() issue is that os.fsdecode() and 
os.fsencode() are not updated, they continue to use UTF-8. Example on Windows:

>>> import sys, os
>>> sys.getfilesystemencoding()
'utf-8'
>>> os.fsencode('\xe9')
b'\xc3\xa9'
>>> sys._enablelegacywindowsfsencoding()
>>> sys.getfilesystemencoding()
'mbcs'
>>> os.fsencode('\xe9')
b'\xc3\xa9'

See bpo-29241 for larger issues caused by this function.

--

The first reason is deprecate this function is that it sounds dangerous to me 
and it doesn't seem to be used.

I only found one project which used it temporarily until they fixed their code 
to encode/decode filenames on Windows. It was used to workaround a in bug in 
their code.

--

___
Python tracker 

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



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

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset d2ec81a8c99796b51fb8c49b77a7fe369863226f by Victor Stinner in 
branch 'master':
bpo-39573: Add Py_SET_TYPE() function (GH-18394)
https://github.com/python/cpython/commit/d2ec81a8c99796b51fb8c49b77a7fe369863226f


--

___
Python tracker 

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



[issue37413] Deprecate sys._enablelegacywindowsfsencoding()?

2020-02-07 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue37413] Deprecate sys._enablelegacywindowsfsencoding()

2020-02-07 Thread STINNER Victor


Change by STINNER Victor :


--
title: Deprecate sys._enablelegacywindowsfsencoding()? -> Deprecate 
sys._enablelegacywindowsfsencoding()

___
Python tracker 

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



[issue37413] Deprecate sys._enablelegacywindowsfsencoding()?

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:

See also draft PEP 597 which proposes to use UTF-8 by default on Windows in 
Python 3.10:
https://www.python.org/dev/peps/pep-0597/

--

___
Python tracker 

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



[issue35134] Add a new Include/cpython/ subdirectory for the "CPython API" with implementation details

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset bec4186c67345f1e6cd3f8a531bc228f14d7ed7b by Victor Stinner in 
branch 'master':
bpo-35134: Create Include/cpython/listobject.h (GH-18395)
https://github.com/python/cpython/commit/bec4186c67345f1e6cd3f8a531bc228f14d7ed7b


--

___
Python tracker 

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



[issue39500] Document PyUnicode_IsIdentifier() function

2020-02-07 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +17773
pull_request: https://github.com/python/cpython/pull/18397

___
Python tracker 

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



[issue39511] [subinterpreters] Per-interpreter singletons (None, True, False, etc.)

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:

Ah, I also found the idea of immortal None in an old discussion on tagged 
pointer:
https://mail.python.org/archives/list/capi-...@python.org/thread/JPUNPN3AILGXOA3C2TTSLMOFNSWJE3QX/

Stefan Behnel proposed the idea: "All negative refcounts would have special 
meanings, such as: this is the immortal None, (...)".

--

___
Python tracker 

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



[issue39576] Surprising MemoryError in `decimal` with MAX_PREC

2020-02-07 Thread Mark Dickinson


Mark Dickinson  added the comment:

Agreed that this seems surprising.

@Vedran: Trailing zeros in a Decimal object are significant, so 
`Decimal("2.0")` and `Decimal("2.00")` are different (equal, but different). 
The rules about the "ideal exponent" of the result of an arithmetic operation 
are well-specified. In this case, the spec is clear that the answer should be 
`Decimal("2")`, and not `Decimal("2.0")` or `Decimal("2.00")`, or 

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue37413] Deprecate sys._enablelegacywindowsfsencoding()

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:

> It's probably worth at least a post to python-dev to expand the audience, but 
> unless someone speaks up with some really good reason why they must update to 
> Python 3.10 without updating their own code then let's deprecate it.

I don't think that it deserves to be discussed on python-dev. I propose PR 
18396 to add a deprecation in Python 3.9. We can open a discussion once we will 
reach the point of actually removing the feature. It's easy to revert a 
deprecation if needed.

--

___
Python tracker 

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



[issue39576] Surprising MemoryError in `decimal` with MAX_PREC

2020-02-07 Thread Vedran Čačić

Vedran Čačić  added the comment:

Yeah, I should have said "represent" instead of "write". :-)

--

___
Python tracker 

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



[issue39574] str.__doc__ is misleading

2020-02-07 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

The docs are correct, you are just misinterpreting them. Which could, I guess, 
suggest the docs could do with improvement.

With *one* argument, `str(obj)` returns a string via `object.__str__(obj)` or 
`repr(obj)`, whichever is defined. That includes the case where obj is a bytes 
object.

*Only* in the two or three argument case where you explicitly provide either 
the encoding or errors parameter will bytes be decoded. But you must provide at 
least one of encoding or errors. If you provide neither, you have the 
one-argument form above.

The default value for encoding is only relevant in cases like this:

# encoding defaults to sys.getdefaultencoding()
py> str(b'a', errors='ignore')
'a'



Here's my suggested rewording:


***


str(object='') -> str
str(bytes_or_buffer [, encoding] [, errors]) -> str

Create a new string object from the given object.

If a single argument is given, returns the result of object.__str__() (if 
defined) or repr(object).

If encoding or errors or both are specified, then the object must expose a data 
buffer that will be decoded using the given encoding and error handler. If 
errors is specified, the default encoding is sys.getdefaultencoding(). If 
encoding is specified, errors defaults to 'strict'.

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



[issue39577] venv --prompt argument is ignored

2020-02-07 Thread Andrea


New submission from Andrea :

In creating a new virtual environment, the help suggest a --prompt argument to 
specify a different name by the time the environment is active.

https://docs.python.org/3/library/venv.html

The argument is apparently ignored as the folder name always appears instead to 
whatever is specified in the prompt.
Checking at the config file content there nothing written inside, thought I'm 
not sure this should be the case.

--
messages: 361548
nosy: andream
priority: normal
severity: normal
status: open
title: venv --prompt argument is ignored
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



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

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:

To make PyObject opaque, we would have to convert Py_INCREF() and Py_DECREF() 
to opaque function calls. Example:

#define Py_XINCREF(op) Py_IncRef(op)
#define Py_XDECREF(op) Py_DecRef(op)

Benchmarks should be run to measure to overhead and balance the advantages and 
drawbacks.

--

___
Python tracker 

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



[issue36843] AIX build fails with failure to get random numbers

2020-02-07 Thread Michael Felt


Michael Felt  added the comment:

FYI: I was contacted this week by someone with this problem. 

The problem was resolved after they updated AIX (was 7100-04-00-).

Please note: any oslevel -s reporting six zeros at the end needs the SP that is 
released in parallel with the base.

--
nosy: +Michael.Felt

___
Python tracker 

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



[issue39574] str.__doc__ is misleading

2020-02-07 Thread Eric V. Smith


Eric V. Smith  added the comment:

That's a good improvement, Steven. I like your wording about errors better than 
the wording about encoding, so how about changing the next to last sentence to:

"If errors is specified, encoding defaults to sys.getdefaultencoding()."

--
nosy: +eric.smith

___
Python tracker 

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



[issue39578] MagicMock specialisation instance can no longer be passed to new MagicMock instance

2020-02-07 Thread Frank Harrison


New submission from Frank Harrison :

This is my first bug logged here, I've tried to follow the guideline and search 
for this issue; please let me know if I missed anything.

Summary:
unittest.mock.MagicMock has a regression starting in 3.8. The regression was 
only tested on latest non-prerelease versions of python 3.5, 3.6, 3.7, 3.8 and 
3.9. Tested on OSX and Fedora 31.

Repro:
--
If you create an instance of a MagicMock specialisation with parameters to 
__init__(),  you can no longer pass that instance to the __init__() function of 
another MagicMock object e.g. a base-class is replaced with MagicMock. See the 
unittests bellow for more details, use-cases and fail situations.

What happens:
-
Here's a python3.9 example traceback. It may be worth noting that there is a 
difference in the tracebacks between 3.8 and 3.9.

Traceback (most recent call last):
  File "<...>", line <..>, in test_raw_magic_moc_passing_thru_single_pos
mock_object = mock.MagicMock(mock_param)  # error is here, instantiating 
another object
  File "/usr/lib64/python3.9/unittest/mock.py", line 408, in __new__
if spec_arg and _is_async_obj(spec_arg):
  File "/usr/lib64/python3.9/unittest/mock.py", line 2119, in __get__
return self.create_mock()
  File "/usr/lib64/python3.9/unittest/mock.py", line 2112, in create_mock
m = parent._get_child_mock(name=entry, _new_name=entry,
  File "/usr/lib64/python3.9/unittest/mock.py", line 1014, in _get_child_mock
return klass(**kw)
TypeError: __init__() got an unexpected keyword argument 'name'


Code demonstrating the problem:
---

import unittest

from unittest import mock


class TestMockMagicAssociativeHierarchies(unittest.TestCase):
""" Mimicing real-world testing where we mock a base-class

The intent here is to demonstrate some of the requirements of associative-
hierarchies e.g. where a class may have its associative-parent set at
run-time, rather that defining it via a class-hierarchy. Obviously this
also needs to work with class-hierarchies, that is an associative-parent is
likely to be a specialisation of some interface, usually one that is being
mocked.

For example tkinter and Qt have both a class-hierarchy and a layout-
hierarchy; the latter is modifyable at runtime.

Most of the tests here mimic a specialisation of an upstream object (say a
tk.Frame class), instantiating that specialisation and then passing it to
another object. The reason behind this is an observed regression in Python
3.8.
"""
def test_raw_magic_moc_passing_thru_no_params(self):
""" REGRESSION: Python3.8 (inc Python3.9)

Create a mocked specialisation passing it to another mock.

One real-world use-case for this is simple cases where we simply want to
define a new convenience type that forces a default configuration of
the inherited type (calls super().__init__()).
"""
class MockSubCallsParentInit(mock.MagicMock):
def __init__(self):
super().__init__()  # intentionally empty
mock_param = MockSubCallsParentInit()
mock_object = mock.MagicMock(mock_param)  # error is here, 
instantiating another object
self.assertIsInstance(mock_object, mock.MagicMock)

def test_raw_magic_moc_passing_thru_single_pos(self):
""" REGRESSION: Python3.8 (inc Python3.9)

Same as test_raw_magic_moc_no_init_params() but we want to specialise
with positional arguments. """
class MockSubCallsParentInitWithPositionalParam(mock.MagicMock):
def __init__(self):
super().__init__("specialise init calls")
mock_param = MockSubCallsParentInitWithPositionalParam()
mock_object = mock.MagicMock(mock_param)  # error is here, 
instantiating another object
self.assertIsInstance(mock_object, mock.MagicMock)

def test_raw_magic_moc_passing_thru_single_kwarg(self):
""" REGRESSION: Python3.8 (inc Python3.9)

Same as test_raw_magic_moc_passing_thru_single_pos() but we want to
specialise with a key-word argument. """
class MockSubCallsParentInitWithPositionalParam(mock.MagicMock):
def __init__(self):
super().__init__(__some_key_word__="some data")
mock_param = MockSubCallsParentInitWithPositionalParam()
mock_object = mock.MagicMock(mock_param)  # error is here, 
instantiating another object
self.assertIsInstance(mock_object, mock.MagicMock)

def test_mock_as_param_no_inheritance(self):
""" PASSES 

Mimic mocking out types, without type specialisation.
for example in pseudo code 
tk.Frame = mock.MagicMock; tk.Frame(t.Frame) """
mock_param = mock.MagicMock()
mock_object = mock.MagicMock(mock_param)
self.assertIsInstance(mock_object, mock.MagicMock)

def test_mock_as_param_no_init_override(self)

[issue39578] MagicMock specialisation instance can no longer be passed to new MagicMock instance

2020-02-07 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +cjw296, lisroach, mariocj89, michael.foord, xtreak

___
Python tracker 

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



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

2020-02-07 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +17774
pull_request: https://github.com/python/cpython/pull/18398

___
Python tracker 

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



[issue39577] venv --prompt argument is ignored

2020-02-07 Thread Karthikeyan Singaravelan

Karthikeyan Singaravelan  added the comment:

Can you please add a reproducer of the steps along with the operating system 
and python version? The --prompt was modified in 3.9 to accept "." so that the 
current folder name is used in issue38901.

# Use custom name as testing for the prompt

➜  cpython git:(master) ./python.exe -m venv foo-venv --prompt testing
➜  cpython git:(master) ✗ source foo-venv/bin/activate
(testing) ➜  cpython git:(master) ✗ deactivate

# Delete to recreate with prompt as . so that basename is used

➜  cpython git:(master) ✗ rm -rf foo-venv
➜  cpython git:(master) ./python.exe -m venv foo-venv --prompt .
➜  cpython git:(master) ✗ source foo-venv/bin/activate
(cpython) ➜  cpython git:(master) ✗

--
nosy: +vinay.sajip, xtreak

___
Python tracker 

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



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

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:

Would a Py_TYPE_IS() macro help code readability?

For example:
#define Future_CheckExact(obj) (Py_TYPE(obj) == &FutureType)
would become:
#define Future_CheckExact(obj) (Py_TYPE_IS(obj, &FutureType))

Py_TYPE_IS() would be more efficient for tagged pointers.

I'm not sure about the macro name. Neil used Py_IS_TYPE(obj, type).

Note: Py_TYPE_EQ(obj, type) name sounds confusing since the first parameter is 
an object, whereas the second one is a type.

--

___
Python tracker 

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



[issue38644] Pass explicitly tstate to function calls

2020-02-07 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +17775
pull_request: https://github.com/python/cpython/pull/18399

___
Python tracker 

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



[issue39578] MagicMock specialisation instance can no longer be passed to new MagicMock instance

2020-02-07 Thread Frank Harrison


Frank Harrison  added the comment:

Minor correction: The regression was only tested on Python 3.9.0a2 (Fedora), 
Python 3.9a3 (OSX), CPython's master (build from source) and the latest 
non-prerelease versions of python 3.5, 3.6, 3.7, and 3.8. Tested on OSX and 
Fedora 31.

--

___
Python tracker 

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



[issue37413] Deprecate sys._enablelegacywindowsfsencoding()

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:

Oh, INADA-san found an issue of this function: Mercurial. I close this issue 
and I closed my PR. We can reconsider to deprecate the function once Mercurial 
will stop to use it.

Copy of INADA-san message:

"""
I think we should keep this several years.

Currently, mercurial depends on it.
https://www.mercurial-scm.org/repo/hg/file/tip/mercurial/pycompat.py#l103

There is a plan for moving to UTF-8 path, and legacyfsencoding is not needed if 
this plan is implemented. But I don't know about current progress of this plan.
https://www.mercurial-scm.org/wiki/WindowsUTF8Plan
"""

https://github.com/python/cpython/pull/18396#issuecomment-583284632

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



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

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset c65b320a95784d2b2133926921d67ac439259e9f by Victor Stinner in 
branch 'master':
bpo-39573: Use Py_TYPE() macro in object.c (GH-18398)
https://github.com/python/cpython/commit/c65b320a95784d2b2133926921d67ac439259e9f


--

___
Python tracker 

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



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

2020-02-07 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +17776
pull_request: https://github.com/python/cpython/pull/18400

___
Python tracker 

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



[issue38644] Pass explicitly tstate to function calls

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 877ea88934a5164be4d9f15207694fad4173d87d by Victor Stinner in 
branch 'master':
bpo-38644: Add Py_EnterRecursiveCall() to python3.def (GH-18399)
https://github.com/python/cpython/commit/877ea88934a5164be4d9f15207694fad4173d87d


--

___
Python tracker 

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



[issue38644] Pass explicitly tstate to function calls

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:

> One further step would be to change the VECTORCALL/FASTCALL calling 
> convention to pass tstate.

My first strong motivation is to get None singleton from tstate. It's now being 
discussed in bpo-39511: "[subinterpreters] Per-interpreter singletons (None, 
True, False, etc.)".

--

___
Python tracker 

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



[issue39574] str.__doc__ is misleading

2020-02-07 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Eric: sure, I'm happy with your modification.

Alas, I'm currently having technology issues which prevents me from 
doing a PR. Would you care to do the honours?

--

___
Python tracker 

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



[issue39460] test_zipfile: test_add_file_after_2107() sometimes fails on Fedora Rawhide 3.x: Linux VFS/XFS bug

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:

It seems like AIX also has a kernel issue with timestamp after year 2038. The 
year 2107 is stored as year 1972.

test_add_file_after_2107 (test.test_zipfile.StoredTestsWithSourceFile) ... 
skipped 'Linux VFS/XFS kernel bug detected: mtime_ns=913015040'

https://bugs.python.org/issue39502#msg361116

>>> print(datetime.datetime.fromtimestamp(91301504))
1972-11-22 18:31:44

--

The test is now skipped if the kernel or filesystem stores incorrectly the 
timestamp 4386268800 (2108-12-30). I don't think that we can do much more.

On the Linux kernel side, we reported the issue to:
https://bugzilla.redhat.com/show_bug.cgi?id=1795576

I close this issue.

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



[issue38699] socket: change listen() default backlog from 128 to 4096?

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:

There is no clear consensus to change socket.listen() default backlog, so I 
close the issue.

> Anyway asyncio at least should probably update its default.

If someone cares, please open a separated issue ;-)

> To be clear: I do still think that using a large value by default, and 
> clamping user input values at 65535, would be improvements. I just don't 
> think they're important enough to spend energy arguing about it :-).

I dislike having to workaround operating system bugs. If the function 
misbehaves, I would prefer to see the OS being fixed, than Python trying to 
guess which value is supposed to work or not.

   int listen(int sockfd, int backlog);

backlog type is an int: its maximum value is INT_MAX. If the kernel rejects 
values larger than 65535, the kernel and/or the libc should reject such value.

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

___
Python tracker 

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



[issue37266] Daemon threads must be forbidden in subinterpreters

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:

FYI python-jep project is broken by this change:
https://bugzilla.redhat.com/show_bug.cgi?id=1792062

"JEP embeds CPython in Java through JNI and is safe to use in a heavily 
threaded environment."
https://github.com/ninia/jep 

FAIL: test_shared_modules_threads (test_shared_modules.TestSharedModules)
--
Traceback (most recent call last):
  File 
"/builddir/build/BUILD/jep-3.9.0/src/test/python/test_shared_modules.py", line 
15, in test_shared_modules_threads
jep_pipe(build_java_process_cmd('jep.test.TestSharedModulesThreads'))
  File "/usr/lib64/python3.9/contextlib.py", line 240, in helper
return _GeneratorContextManager(func, args, kwds)
  File "/usr/lib64/python3.9/contextlib.py", line 83, in __init__
self.gen = func(*args, **kwds)
  File "/builddir/build/BUILD/jep-3.9.0/src/test/python/jep_pipe.py", line 36, 
in jep_pipe
assert False, stderr
AssertionError: b'Exception in thread "main" jep.JepException: : daemon thread are not supported in subinterpreters\n\tat 
/usr/lib64/python3.9/threading.start(threading.py:858)\n\tat 
.(:1)\n\tat jep.Jep.eval(Native Method)\n\tat 
jep.Jep.eval(Jep.java:451)\n\tat 
jep.test.TestSharedModulesThreads.main(TestSharedModulesThreads.java:53)\n'

--

___
Python tracker 

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



[issue37266] Daemon threads must be forbidden in subinterpreters

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:

I reported the issue to jep: https://github.com/ninia/jep/issues/229

--

___
Python tracker 

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



[issue38207] subprocess: Popen.kill() + Popen.communicate() is blocking until all processes using the pipe close the pipe

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:

My use case was specific to regrtest. I solved the issue differently in 
regrtest. I close the issue.

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

___
Python tracker 

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



[issue35760] test_asyncio: test_async_gen_asyncio_gc_aclose_09() race condition

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:

I didn't see the failure recently, I close it.

--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue36339] test_ttk_guionly: test_traversal() fails randomly on AMD64 Windows8.1 Refleaks 2.7

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:

I didn't see the failure recently, I close it.

Moreover, Python 2 is not longer supported.

--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue37155] test_asyncio: test_stdin_broken_pipe() failed on AMD64 FreeBSD CURRENT Shared 3.x

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:

I didn't see the failure recently, I close it.

--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue38184] test_site: test_s_option() failed on AMD64 Fedora Rawhide Refleaks 2.7 and AMD64 Fedora Stable Refleaks 3.7

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:

I didn't see the failure recently, I close it.

--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue31447] proc communicate not exiting on python subprocess timeout using PIPES

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:

See also bpo-38207: "subprocess: Popen.kill() + Popen.communicate() is blocking 
until all processes using the pipe close the pipe".

--
nosy: +vstinner

___
Python tracker 

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



[issue36632] test_multiprocessing_forkserver: test_rapid_restart() leaked a dangling process on AMD64 FreeBSD 10-STABLE Non-Debug 3.x

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:

I didn't see the failure recently, I close it.

--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue37368] test_asyncio: test_create_server_ssl_match_failed() failed on s390x SLES 3.x and logged an unraisable exception

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:

I didn't see the failure recently, I close it.

--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue37338] test_multiprocessing_forkserver, SemLock: test_thousand() logged on AMD64 Ubuntu Shared 3.x: Exception ignored in:

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:

I didn't see the failure recently, I close it.

--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue37928] test_glob.test_selflink() fails randomly on AMD64 Fedora Rawhide Clang Installed 3.x

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:

I didn't see the failure recently, I close it.

--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue38182] test_asyncio: SubprocessMultiLoopWatcherTests.test_stdin_stdout() failed on AMD64 FreeBSD 10-STABLE Non-Debug 3.x

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:

I mark this issue as a duplicate of bpo-38323.

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> asyncio: MultiLoopWatcher has a race condition (test_asyncio: 
test_close_kill_running() hangs on AMD64 RHEL7 Refleaks 3.x)

___
Python tracker 

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



[issue38323] asyncio: MultiLoopWatcher has a race condition (test_asyncio: test_close_kill_running() hangs on AMD64 RHEL7 Refleaks 3.x)

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:

I marked bpo-38182 as a duplicate of this issue: "test_asyncio: 
SubprocessMultiLoopWatcherTests.test_stdin_stdout() failed on AMD64 FreeBSD 
10-STABLE Non-Debug 3.x".

--

___
Python tracker 

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



[issue38447] test_multiprocessing_spawn: Dangling processes: {} on AMD64 RHEL7 Refleaks 3.7

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:

I didn't see this issue recently, I close the issue.

--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue38276] test_asyncio: test_cancel_make_subprocess_transport_exec() failed on RHEL7 LTO + PGO 3.x

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:

I didn't see this issue recently, I close the issue.

--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue38338] [2.7] test_ssl: test_protocol_sslv23() and test_protocol_tlsv1_1() fail on RHEL8

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:

Python 2.7 is no longer maintained, I close this issue.

--
resolution:  -> out of date
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue38476] test_multiprocessing_fork.test_terminate() failed on AMD64 Debian PGO 3.x

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:

I didn't see this issue recently, I close the issue.

--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue38795] test_asyncio.test_subprocess.test_terminate() timed out on AMD64 RHEL8 LTO + PGO 3.x

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:

I didn't see this issue recently, I close the issue.

--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue38796] test_multiprocessing_forkserver: test_mymanager_context() failed on AMD64 FreeBSD Non-Debug 3.x

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:

I didn't see this issue recently, I close the issue.

--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue39238] test_asyncio: test_cancel_make_subprocess_transport_exec() hangs randomly on PPC64LE Fedora 3.x

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:

It only failed twice, I didn't see this issue recently, I close the issue.

--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue39268] test_asyncio: test_create_server_ssl_verified() failed on AMD64 FreeBSD Non-Debug 3.x

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:

I didn't see this issue recently, I close the issue.

--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue39014] test_concurrent_futures: test_crash() timed out on AMD64 Fedora Rawhide Refleaks 3.x

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:

I didn't see these issues recently, I close the issue.

--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue39266] [2.7] test_bsddb3 leaked [1, 1, 1] file descriptors on AMD64 RHEL7 Refleaks 2.7

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:

Python 2.7 is no longer supported, I close the issue.

--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue38578] test_concurrent_futures failed on AMD64 FreeBSD Shared 3.8

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:

I didn't see this issue recently, I close the issue.

--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue39005] test_faulthandler: test_dump_traceback_later_file() fails randomly on AMD64 RHEL8 Refleaks 3.x

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:

I didn't see this issue recently, I close the issue.

--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue36732] Windows: test_asyncio: test_huge_content_recvinto() fails randomly with ProactorEventLoop

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:

I didn't see the failure recently, I close the issue.

--
resolution:  -> out of date
status: open -> closed

___
Python tracker 

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



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

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset b10dc3e7a11fcdb97e285882eba6da92594f90f9 by Victor Stinner in 
branch 'master':
bpo-39573: Add Py_SET_SIZE() function (GH-18400)
https://github.com/python/cpython/commit/b10dc3e7a11fcdb97e285882eba6da92594f90f9


--

___
Python tracker 

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



[issue39574] str.__doc__ is misleading

2020-02-07 Thread Eric V. Smith


Change by Eric V. Smith :


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

___
Python tracker 

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



[issue39574] str.__doc__ is misleading

2020-02-07 Thread Eric V. Smith


Eric V. Smith  added the comment:

I've created a PR and requested review from stevendaprano. I think the 
backports are correct.

--

___
Python tracker 

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



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

2020-02-07 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +17778
pull_request: https://github.com/python/cpython/pull/18402

___
Python tracker 

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



[issue38324] [Windows] test_locale and test__locale failures on Windows

2020-02-07 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue38324] [Windows] test_locale and test__locale failures on Windows

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:

test_locale and test__locale are still failing on my Windows 10 VM. I proposed 
PR 18403 to skip failing tests on Windows.

--

___
Python tracker 

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



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

2020-02-07 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

You have merged so much PRs today. What they do?

PyObject cannot just be made an opaque structure. The user code reads and 
writes its fields directly and via macros. This change would break working code.

We can encourage the user code to prepare to making PyObject an opaque 
structure. We need to provide a stable C API for access of PyObject fields for 
this. Note that there is a performance penalty of using functions instead of 
direct access, so you should have very good reasons to do this.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue39574] str.__doc__ is misleading

2020-02-07 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

See a discussion on Python-Dev: 
https://mail.python.org/archives/list/python-...@python.org/message/YMIGWRUERUG66CKRJXDXNPCIDHRQJY6V/

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue1635741] Py_Finalize() doesn't clear all Python objects at exit

2020-02-07 Thread hai shi


Change by hai shi :


--
pull_requests: +17780
pull_request: https://github.com/python/cpython/pull/18404

___
Python tracker 

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



[issue39579] Attribute node in a decorator has wrong end_col_offset

2020-02-07 Thread Lysandros Nikolaou


New submission from Lysandros Nikolaou :

There is a problem with the end_col_offset of nested Attribute nodes in 
decorators. For example, parsing

@a.b.c
def f(): pass

produces the following AST tree (part):

decorator_list=[
Attribute(
value=Attribute(
value=Name(
id="a",
ctx=Load(),
lineno=1,
col_offset=1,
end_lineno=1,
end_col_offset=2,
),
attr="b",
ctx=Load(),
lineno=1,
col_offset=1,
end_lineno=1,
*end_col_offset=6*,
),
attr="c",
ctx=Load(),
lineno=1,
col_offset=1,
end_lineno=1,
end_col_offset=6,
)
],

Note that the Attribute node with attr="b" has end_col_offset=6, while it 
should actually be 4.

--
components: Interpreter Core
messages: 361595
nosy: gvanrossum, lys.nikolaou, pablogsal
priority: normal
severity: normal
status: open
title: Attribute node in a decorator has wrong end_col_offset
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



[issue39579] Attribute node in a decorator has wrong end_col_offset

2020-02-07 Thread Lysandros Nikolaou


Change by Lysandros Nikolaou :


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

___
Python tracker 

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



[issue36225] Lingering subinterpreters should be implicitly cleared on shutdown

2020-02-07 Thread Maciej Szulik


Change by Maciej Szulik :


--
nosy: +maciej.szulik

___
Python tracker 

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



[issue38880] Subinterpreters: List interpreters associated with a channel end

2020-02-07 Thread Maciej Szulik


Change by Maciej Szulik :


--
nosy: +maciej.szulik

___
Python tracker 

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



[issue39511] [subinterpreters] Per-interpreter singletons (None, True, False, etc.)

2020-02-07 Thread Maciej Szulik


Change by Maciej Szulik :


--
nosy: +maciej.szulik

___
Python tracker 

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



[issue39576] Surprising MemoryError in `decimal` with MAX_PREC

2020-02-07 Thread Stefan Krah


Stefan Krah  added the comment:

With _pydecimal the memory also grows very slowly (I didn't have the patience 
to wait for MemoryError).

I'm pretty sure decNumber also does the same, it's just easier to implement 
and does not slow down division for small numbers.

libmpdec always favors precisions from roughly 9-34 digits whenever 
there's a potential performance issue.

The only thing I could imagine is to special-case, say, prec > 1.

--
nosy: +skrah

___
Python tracker 

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



[issue36876] Global C variables are a problem.

2020-02-07 Thread Maciej Szulik


Change by Maciej Szulik :


--
nosy: +maciej.szulik

___
Python tracker 

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



[issue36877] [meta] Move fields from _PyRuntimeState to PyInterpreterState.

2020-02-07 Thread Maciej Szulik


Change by Maciej Szulik :


--
nosy: +maciej.szulik

___
Python tracker 

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



[issue10915] Make the PyGILState API compatible with multiple interpreters

2020-02-07 Thread Maciej Szulik


Change by Maciej Szulik :


--
nosy: +maciej.szulik

___
Python tracker 

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



[issue33608] Add a cross-interpreter-safe mechanism to indicate that an object may be destroyed.

2020-02-07 Thread Maciej Szulik


Change by Maciej Szulik :


--
nosy: +maciej.szulik

___
Python tracker 

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



[issue15751] Support subinterpreters in the GIL state API

2020-02-07 Thread Maciej Szulik


Change by Maciej Szulik :


--
nosy: +maciej.szulik

___
Python tracker 

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



[issue39576] Surprising MemoryError in `decimal` with MAX_PREC

2020-02-07 Thread Stefan Krah


Stefan Krah  added the comment:

MAX_PREC is chosen so that 5*MAX_PREC does not overflow 32-bit or 64-bit signed 
integers. This eliminates many overflow checks for the exponent.

Updating the exponent is (perhaps surprisingly) quite performance sensitive, 
that's why the 32-bit build does not use a 64-bit exponent.

--

___
Python tracker 

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



[issue37292] _xxsubinterpreters: Can't unpickle objects defined in __main__

2020-02-07 Thread Maciej Szulik


Change by Maciej Szulik :


--
nosy: +maciej.szulik

___
Python tracker 

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



[issue39576] Surprising MemoryError in `decimal` with MAX_PREC

2020-02-07 Thread Stefan Krah


Stefan Krah  added the comment:

The feature would be nice to have; however, if you choose the precision to 
match the amount of available RAM things work (I have 8GB here, one word in the 
coefficient has 19 digits for the 4 bit version):

>>> from decimal import *
>>> c = getcontext()
>>> c.prec = 8 * 2**30 // 64 * 19
>>> c.prec
2550136832
>>> i = Decimal(4)
>>> i / 2
Decimal('2')



So I wonder if we really need to do something here.

--

___
Python tracker 

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



[issue39576] Surprising MemoryError in `decimal` with MAX_PREC

2020-02-07 Thread Tim Peters


Tim Peters  added the comment:

Vedran, as Mark said, the result is defined to have no trailing zeroes.  In 
general the module strives to return results "as if" infinite precision were 
used internally, not to actually _use_ infinite precision internally ;-)  Given 
the same setup, e.g.,

>>> i * decimal.Decimal(0.5)
Decimal('2.0')

works fine.

This isn't purely academic.  The `decimal` docs, at the end:

"""
Q. Is the CPython implementation fast for large numbers?

A. Yes. ...
However, to realize this performance gain, the context needs to be set for 
unrounded calculations.

>>> c = getcontext()
>>> c.prec = MAX_PREC
>>> c.Emax = MAX_EMAX
>>> c.Emin = MIN_EMIN
"""

I suggested this approach to someone on Stackoverflow, who was trying to 
compute and write out the result of a multi-hundred-million-digit integer 
exponentiation.  Which worked fine, and was enormously faster than using 
CPython's bigints.

But then I noticed "trivial" calculations - like the one here - blowing up with 
MemoryError too.  Which made sense for, e.g., 1/7, but not for 1/2.

I haven't looked at the implementation.  I assume it's trying in advance to 
reserve space for a result with MAX_PREC digits.

It's not limited to division; e.g.,

>>> c.sqrt(decimal.Decimal(4))
...
MemoryError

is also surprising.

Perhaps the only thing to be done is to add words to the part of the docs 
_recommending_ MAX_PREC, warning about some "unintended consequences" of doing 
so.

--

___
Python tracker 

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



[issue22213] Make pyvenv style virtual environments easier to configure when embedding Python

2020-02-07 Thread Leslie


Leslie  added the comment:

I just can say that sorting this issue (and PEP-0432) out would be great!
I run into this issue when embedding CPython in a Windows app, and want to use 
some pre-installed Python, which is not part of the install package...
So beside pyenv venvs, please keep Windows devs in mind, too!
:)

--
nosy: +Leslie

___
Python tracker 

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



[issue39576] Surprising MemoryError in `decimal` with MAX_PREC

2020-02-07 Thread Stefan Krah


Stefan Krah  added the comment:

> This isn't purely academic.  The `decimal` docs, at the end:

Yes, that is a good point. I think for libmpdec I'll just do a trial divmod if 
prec > BIGNUM_THRESHOLD.



> Perhaps the only thing to be done is to add words to the part of the docs 
> _recommending_ MAX_PREC, warning about some "unintended consequences" of 
> doing so.

This, too. Probably some formula based on the amount of available RAM would do.

--
assignee:  -> skrah

___
Python tracker 

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



[issue39552] shell scripts use legacy

2020-02-07 Thread Stefan Krah


New submission from Stefan Krah :

As mentioned in the PR, I don't see sufficient evidence that backticks are 
legacy.  So I'll close this.

--
assignee:  -> skrah
nosy: +skrah
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



[issue1635741] Py_Finalize() doesn't clear all Python objects at exit

2020-02-07 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



[issue39502] test_zipfile fails on AIX due to time.localtime

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset de6f38db4859f7b8fe4da4556f06c52675fff24a by Michael Felt in 
branch 'master':
bpo-39502: Fix 64-bit Python PyTime_localtime() on AIX  (GH-18285)
https://github.com/python/cpython/commit/de6f38db4859f7b8fe4da4556f06c52675fff24a


--

___
Python tracker 

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



[issue39502] test_zipfile fails on AIX due to time.localtime

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:

Does time.gmtime() accept year after 2038 on 64-bit AIX? Example on Linux:

>>> time.gmtime(4386268800)
time.struct_time(tm_year=2108, tm_mon=12, tm_mday=30, tm_hour=0, tm_min=0, 
tm_sec=0, tm_wday=6, tm_yday=365, tm_isdst=0)

--

___
Python tracker 

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



[issue37088] Add a way to schedule a function to be called from the main thread

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:

There is not clear rationale to justify the addition of the function, so I 
reject the feature. If you are still interesting by the function, please 
elaborate the rationale.

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



[issue39576] Surprising MemoryError in `decimal` with MAX_PREC

2020-02-07 Thread Tim Peters


Tim Peters  added the comment:

Formulas based on physical RAM probably work well on Linux, but not so well on 
Windows:  Windows has no "overcommit".  Whether a virtual memory request 
succeeds on Windows depends on how much RAM (+ swap space, if any) has already 
been requested across all processes.  It doesn't matter whether pages have 
actually been created, merely the total number of pages that _may_ be created.

I never bumped into this issue before, because I never used MAX_PREC before ;-) 
 When I intended to do exact arithmetic in `decimal`, I did this instead:

- guesstimated the max number of decimal digits a computation would need

- set `prec` to be comfortably - but not massively - larger than that

- enabled the Inexact trap, so if I guessed too low I'd get an exception

Maybe the docs could suggest that instead?

--

___
Python tracker 

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



[issue12782] Multiple context expressions do not support parentheses for continuation across lines

2020-02-07 Thread jack1142


Change by jack1142 :


--
nosy: +jack1142

___
Python tracker 

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



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

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:

> You have merged so much PRs today. What they do?

I merged changes which prepares CPython code base to make PyObject opaque. I 
only merged changes which should have no impact on performance, but prepare the 
API to make the structure opaque.

Right now, Py_SET_REFNCT() stills access directly to PyObject.ob_refcnt. But it 
becomes possible to make Py_SET_REFNCT() an opaque function call.

Do you see any issue with the changes that I already merged? Using PGO+LTO, 
static inline functions should be as efficient as the previous code using 
Py_REFCNT() & cie macros.


> PyObject cannot just be made an opaque structure. The user code reads and 
> writes its fields directly and via macros. This change would break working 
> code.

I'm trying to modifying the limited C API to make it possible: all access to 
PyObject fields should go through macros or function calls. The question is now 
how which fields are accessed and how.


> We can encourage the user code to prepare to making PyObject an opaque 
> structure. We need to provide a stable C API for access of PyObject fields 
> for this.

For the short term, I don't plan to make PyObject opaque, so I don't plan to 
enforce usage of Py_TYPE(), Py_SET_REFCNT(), etc.


> Note that there is a performance penalty of using functions instead of direct 
> access, so you should have very good reasons to do this.

Yeah, replacing Py_REFCNT() macro with an opaque function call is likely to 
have an impact on performance. It should be properly measure, I'm well aware of 
that, I already wrote it in a previous comment ;-) I don't plan to push change 
such right now. And I will wait for the review of my peers (like you) for such 
change ;-)

--

___
Python tracker 

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



[issue39432] Distutils generates the wrong export symbol for unicode module names

2020-02-07 Thread Ned Deily

Ned Deily  added the comment:

We should not be changing Distutils 3.7 behavior at this late point in its life 
cycle, particularly since AFAIK this issue has not come up before.  Let's see 
what Łukasz thinks for 3.8.

--
nosy: +lukasz.langa
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



[issue39529] Deprecate get_event_loop()

2020-02-07 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue39529] Deprecate get_event_loop()

2020-02-07 Thread Yury Selivanov


Yury Selivanov  added the comment:

I think we still use get_event_loop() in asyncio code, no? If we do, we should 
start by raising deprecation warnings in those call sites, e.g. if a Future or 
Lock is created outside of a coroutine and no explicit event loop is passed. We 
should do this in 3.9. We can then think about deprecating get_event_loop in 
3.10.

--

___
Python tracker 

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



[issue17422] language reference should specify restrictions on class namespace

2020-02-07 Thread Caleb Donovick


Change by Caleb Donovick :


--
nosy: +donovick

___
Python tracker 

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



[issue39580] Check for COMMAND_LINE_INSTALL variable in Python_Documentation.pkg

2020-02-07 Thread Mike Solin


New submission from Mike Solin :

Hello Python developers!

I'm looking to deploy Python 3 silently to the Macs that I manage, so I can use 
Python for various scripts. I'm using Munki to accomplish this. However, the 
Python_Documentation.pkg subpackage includes this code in the postinstall 
script:

```
# make link in /Applications/Python m.n/ for Finder users
if [ -d "${APPDIR}" ]; then
ln -fhs "${FWK_DOCDIR}/index.html" "${APPDIR}/Python Documentation.html"
open "${APPDIR}" || true  # open the applications folder
fi
```

Would it be possible to test for the $COMMAND_LINE_INSTALL variable before 
opening a Finder window? If the $COMMAND_LINE_INSTALL exists, it'd be really 
great if it didn't open the Finder. This would allow me to silently deploy 
Python 3 without disrupting my users.

Thanks!

Mike

--
components: macOS
messages: 361610
nosy: flammable, ned.deily, ronaldoussoren
priority: normal
severity: normal
status: open
title: Check for COMMAND_LINE_INSTALL variable in Python_Documentation.pkg
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



[issue39580] Check for COMMAND_LINE_INSTALL variable in Python_Documentation.pkg

2020-02-07 Thread Ned Deily


Change by Ned Deily :


--
assignee:  -> ned.deily

___
Python tracker 

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



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

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 60ac6ed5579f130fc264d3b748ee9575e3aa by Victor Stinner in 
branch 'master':
bpo-39573: Use Py_SET_SIZE() function (GH-18402)
https://github.com/python/cpython/commit/60ac6ed5579f130fc264d3b748ee9575e3aa


--

___
Python tracker 

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



[issue39350] Remove deprecated fractions.gcd()

2020-02-07 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset dc7a50d73a3d16918529669ff7b8783c08cff090 by Victor Stinner in 
branch 'master':
bpo-39350: Fix fractions for int subclasses (GH-18375)
https://github.com/python/cpython/commit/dc7a50d73a3d16918529669ff7b8783c08cff090


--

___
Python tracker 

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



  1   2   >