[issue43442] multicorevm: guarantee type multi sub interpreters safe

2021-03-08 Thread junyixie


New submission from junyixie :

in multi core cpython project. 
when use  multi sub interpreters, Type is not safe. Type shared by interpreters.
but isolate type may cause python abi/api change. python 4.0?

temporary solution:
1. add a type lock to guarantee type object safe in multi subinterpreters.
2. some thing like pycmethod object and descr in pytype, set their refcount to 
INT MAX.It is guaranteed that these objects will not be released. and not cause 
memory leaks, only one type exist in memory.

--
messages: 388333
nosy: JunyiXie
priority: normal
severity: normal
status: open
title: multicorevm: guarantee type multi sub interpreters safe

___
Python tracker 

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



[issue43441] mutilcorevm: global variable next_version_tag cause method cache bug

2021-03-08 Thread junyixie


junyixie  added the comment:

fix:
only main interpreter fini, clear method cache. 

void
_PyType_Fini(PyInterpreterState *interp)
{
if (_Py_IsMainInterpreter(interp)) {
clear_slotdefs();
_PyType_ClearCache(>type_cache);
}
}

when python4.0? type isolate, each interpreter dealloc should clear method 
cache.

--

___
Python tracker 

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



[issue43441] mutilcorevm: global variable next_version_tag cause method cache bug

2021-03-08 Thread junyixie


junyixie  added the comment:

when sub interpreter finalize. 
_PyType_ClearCache set next_version_tag = 0. 

Type shared between interpreters. 
another interpreter assign_version_tag "1" for a type, the type is first assign.

the dealloc interpreter had assign_version_tag  "1" for another type.

now, two different type has same version tag. it cause method cache wrong.


static unsigned int
_PyType_ClearCache(struct type_cache *cache)
{
#if MCACHE_STATS
size_t total = cache->hits + cache->collisions + cache->misses;
fprintf(stderr, "-- Method cache hits= %zd (%d%%)\n",
cache->hits, (int) (100.0 * cache->hits / total));
fprintf(stderr, "-- Method cache true misses = %zd (%d%%)\n",
cache->misses, (int) (100.0 * cache->misses / total));
fprintf(stderr, "-- Method cache collisions  = %zd (%d%%)\n",
cache->collisions, (int) (100.0 * cache->collisions / total));
fprintf(stderr, "-- Method cache size= %zd KiB\n",
sizeof(cache->hashtable) / 1024);
#endif

unsigned int cur_version_tag = next_version_tag - 1;
next_version_tag = 0;
type_cache_clear(cache, 0);

return cur_version_tag;
}

--

___
Python tracker 

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



[issue41361] Converting collections.deque methods to Argument Clinic

2021-03-08 Thread Dennis Sweeney


Change by Dennis Sweeney :


--
pull_requests: +23564
pull_request: https://github.com/python/cpython/pull/24796

___
Python tracker 

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



[issue43440] Enable rtree support in SQLite

2021-03-08 Thread Erlend Egeberg Aasland

Erlend Egeberg Aasland  added the comment:

I can put up a PR for it. I don’t see any reason not to enable it.

--

___
Python tracker 

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



[issue43440] Enable rtree support in SQLite

2021-03-08 Thread Erlend Egeberg Aasland

Erlend Egeberg Aasland  added the comment:

Unless I’m mistaken, that’s enabled simply by compiling with 
SQLITE_ENABLE_RTREE defined.

--

___
Python tracker 

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



[issue43420] Optimize rational arithmetics

2021-03-08 Thread Tim Peters


Tim Peters  added the comment:

I agree with everyone ;-) That is, my _experience_ matches Mark's:  as a 
more-or-less "numeric expert", I use Fraction in cases where it's already fast 
enough. Python isn't a CAS, and, e.g., in pure Python I'm not doing things like 
computing or composing power series with rational coefficients (but routinely 
do such stuff in a CAS). It's usually just combinatorial probabilities in 
relatively simple settings, and small-scale computations where float precision 
would be fine except I don't want to bother doing error analysis first to 
ensure things like catastrophic cancellation can't occur.

On the other hand, the proposed changes are bog standard optimizations for 
implementations of rationals, and can pay off very handsomely at relatively 
modest argument sizes.

So I'm +0. I don't really mind the slowdown for small arguments because, as 
above, I just don't use Fraction for extensive computation. But the other side 
of that is that I won't profit much from optimizations either, and while the 
optimizations for * and / are close to self-evident, those for + and - are much 
subtler. Code obscurity imposes ongoing costs of its own.

WRT which, I added Python's Karatsuba implementation and regret doing so. I 
don't want to take it out now (it's already in ;-) ), but it added quite a pile 
of delicate code to what _was_ a much easier module to grasp. People who need 
fast multiplication are still far better off using gmpy2 anyway (or fiddling 
Decimal precision - Stefan Krah implemented "advanced" multiplication schemes 
for that module).

--
nosy: +tim.peters

___
Python tracker 

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



[issue43441] mutilcorevm: global variable next_version_tag cause method cache bug

2021-03-08 Thread junyixie


New submission from junyixie :

type->tp_version_tag = next_version_tag++;
when sub interpreters parallel, next_version_tag++ is thread-unsafe. may cause 
different type has same tp_version_tag.

cause method cache bug in _PyType_Lookup
#define MCACHE_HASH_METHOD(type, name)  \
MCACHE_HASH((type)->tp_version_tag, \
((PyASCIIObject *)(name))->hash)

if (MCACHE_CACHEABLE_NAME(name) &&
_PyType_HasFeature(type, Py_TPFLAGS_VALID_VERSION_TAG)) {
/* fast path */
unsigned int h = MCACHE_HASH_METHOD(type, name);
struct type_cache *cache = get_type_cache();
struct type_cache_entry *entry = >hashtable[h];
if (entry->version == type->tp_version_tag && entry->name == name) {
#if MCACHE_STATS
cache->hits++;
#endif
return entry->value;
}
}



static int
assign_version_tag(struct type_cache *cache, PyTypeObject *type)
{
...
type->tp_version_tag = next_version_tag++;
...
}

--
components: Interpreter Core
messages: 388327
nosy: JunyiXie
priority: normal
severity: normal
status: open
title: mutilcorevm: global variable next_version_tag cause method cache bug
versions: Python 3.10

___
Python tracker 

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



[issue43440] Enable rtree support in SQLite

2021-03-08 Thread Zachary Ware


Change by Zachary Ware :


--
nosy: +berker.peksag, erlendaasland

___
Python tracker 

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



[issue43198] Operations on sets more than hundred times less efficient with python3.9 than with previous versions

2021-03-08 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I've had misgivings about this and will revert the change for Python 3.10.  

Usually, it is safe for sets to implement whatever has been battle-tested with 
dicts, but sets should aspire to do better for alternating deletions and 
re-additions of the same element, even if that isn't a common case.

--
nosy: +tim.peters
resolution: not a bug -> 
status: closed -> open
versions: +Python 3.10 -Python 3.9

___
Python tracker 

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



[issue35118] Add peek() or first() method in queue

2021-03-08 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> I want to examine the first (oldest) element in queue and 
> remove it if it's too old.

Why not just dismiss older queue entries during a normal get() operation?  Or 
just use a plain deque with access guarded by a lock.

FWIW, the standard library queue module doesn't have a straight-forward way to 
implement a peek() method.  The module guarantees that the underlying data 
structure is only accessed with _init, _qsize, _get, and _put.


That would be difficult to do atomically with a Queue object.

--

___
Python tracker 

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



[issue41361] Converting collections.deque methods to Argument Clinic

2021-03-08 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Go ahead with in-lining the argument handling for rotate().  The no argument 
form and the +1 and the -1 case are important enough to warrant the change.

Please skip index() and insert() which aren't essential methods.  Also, those 
methods aren't called with end-point specific arguments, so the argument 
processing time doesn't dominate and it isn't worth it.

--

___
Python tracker 

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



[issue28356] [easy doc] Document os.rename() behavior on Windows when src and dst are on different filesystems

2021-03-08 Thread T-VEy


T-VEy  added the comment:

Eryk, can you please go on details on how are they using different strategies 
to fix bugs but still it's not enough for the time being?Because I know nothing 
about python and I recognized it in a minute of opening the files.I don't even 
have it installed on my pc.I don't even have python, not even version 2.7. 

  On Mon, Mar 8, 2021 at 23:48, Eryk Sun wrote:   
Eryk Sun  added the comment:

T-VEy, this is a documentation-only issue for versions of Python that are under 
active development for bug fixes and enhancements -- 3.8, 3.9, and 3.10.

--
versions: +Python 3.10, Python 3.8

___
Python tracker 

___

--

___
Python tracker 

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



[issue43439] [security] Add audit events on GC functions giving access to all Python objects

2021-03-08 Thread Steve Dower


Steve Dower  added the comment:

Thanks, Pablo! Nice patch.

This can be backported, btw. New audit events are allowed to be added in minor 
releases (they just cannot be changed).

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



[issue43440] Enable rtree support in SQLite

2021-03-08 Thread Steve Dower


Change by Steve Dower :


--
nosy: +ghaering

___
Python tracker 

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



[issue43440] Enable rtree support in SQLite

2021-03-08 Thread Steve Dower


New submission from Steve Dower :

I heard [1] that rtree support would be very useful in SQLite. We should see 
whether enabling it is safe/easy/cheap and then do it.

1: https://twitter.com/Jamieallencook/status/1368221499794976775?s=20

--
components: Build, Library (Lib), Windows
messages: 388320
nosy: paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Enable rtree support in SQLite
type: enhancement
versions: Python 3.10

___
Python tracker 

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



[issue3329] API for setting the memory allocator used by Python

2021-03-08 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +23563
pull_request: https://github.com/python/cpython/pull/24795

___
Python tracker 

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



[issue33955] Implement PyOS_CheckStack on macOS using pthread_get_stack*_np

2021-03-08 Thread STINNER Victor


STINNER Victor  added the comment:

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

--

___
Python tracker 

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



[issue43439] [security] Add audit events on GC functions giving access to all Python objects

2021-03-08 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue29982] tempfile.TemporaryDirectory fails to delete itself

2021-03-08 Thread C.A.M. Gerlach


C.A.M. Gerlach  added the comment:

Thanks! Submitted as PR #24793 https://github.com/python/cpython/pull/24793

--

___
Python tracker 

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



[issue25024] Allow passing "delete=False" to TemporaryDirectory

2021-03-08 Thread C.A.M. Gerlach


Change by C.A.M. Gerlach :


--
pull_requests: +23561
pull_request: https://github.com/python/cpython/pull/24793

___
Python tracker 

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



[issue29982] tempfile.TemporaryDirectory fails to delete itself

2021-03-08 Thread C.A.M. Gerlach


Change by C.A.M. Gerlach :


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

___
Python tracker 

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



[issue43415] Typo in dataclasses documentation

2021-03-08 Thread Eric V. Smith


Eric V. Smith  added the comment:

Thanks!

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



[issue43415] Typo in dataclasses documentation

2021-03-08 Thread Eric V. Smith


Eric V. Smith  added the comment:


New changeset 6d4273356764a3837c914b2aced7a668c534e0be by Miss Islington (bot) 
in branch '3.8':
bpo-43415: Fix typo on dataclasses.rst (GH-24789) (GH-24791)
https://github.com/python/cpython/commit/6d4273356764a3837c914b2aced7a668c534e0be


--

___
Python tracker 

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



[issue43415] Typo in dataclasses documentation

2021-03-08 Thread Eric V. Smith


Eric V. Smith  added the comment:


New changeset fb3b0310305acdfad7c26705c2ee9a8712a43cf4 by Miss Islington (bot) 
in branch '3.9':
bpo-43415: Fix typo on dataclasses.rst (GH-24789) (GH-24790)
https://github.com/python/cpython/commit/fb3b0310305acdfad7c26705c2ee9a8712a43cf4


--

___
Python tracker 

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



[issue43422] Revert _decimal C API changes

2021-03-08 Thread Antoine Pitrou


Change by Antoine Pitrou :


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

___
Python tracker 

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



[issue43415] Typo in dataclasses documentation

2021-03-08 Thread Eric V. Smith


Change by Eric V. Smith :


--
assignee: docs@python -> eric.smith
title: Typo -> Typo in dataclasses documentation

___
Python tracker 

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



[issue43415] Typo

2021-03-08 Thread miss-islington


Change by miss-islington :


--
pull_requests: +23558
pull_request: https://github.com/python/cpython/pull/24791

___
Python tracker 

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



[issue43415] Typo

2021-03-08 Thread Eric V. Smith


Eric V. Smith  added the comment:


New changeset 0554044ddccdb7bf1fa4a8bc880e7a7b59f6479c by Guilherme Martins 
Crocetti in branch 'master':
bpo-43415: Fix typo on dataclasses.rst (#24789)
https://github.com/python/cpython/commit/0554044ddccdb7bf1fa4a8bc880e7a7b59f6479c


--

___
Python tracker 

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



[issue43415] Typo

2021-03-08 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 4.0 -> 5.0
pull_requests: +23557
pull_request: https://github.com/python/cpython/pull/24790

___
Python tracker 

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



[issue43332] Make http.client._tunnel send one byte string over the network

2021-03-08 Thread Senthil Kumaran


Change by Senthil Kumaran :


--
stage: commit review -> resolved

___
Python tracker 

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



[issue43415] Typo

2021-03-08 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
nosy: +python-dev
nosy_count: 3.0 -> 4.0
pull_requests: +23555
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24789

___
Python tracker 

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



[issue43245] Add keyword argument support to ChainMap.new_child()

2021-03-08 Thread Kamil Turek


Change by Kamil Turek :


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

___
Python tracker 

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



[issue43438] [doc] sys.addaudithook() documentation should be more explicit on its limitations

2021-03-08 Thread STINNER Victor


STINNER Victor  added the comment:

Another example of recent Capture The Flag challenge which used audit hooks: 
https://bugs.python.org/issue42800#msg384143

--

___
Python tracker 

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



[issue43321] PyArg_ParseTuple() false-returns SUCCESS though SystemError and missing data (when PY_SSIZE_T_CLEAN not #define'd)

2021-03-08 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks for fixing my bug ;-) (bpo-40943)

--

___
Python tracker 

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



[issue43382] github CI blocked by the Ubuntu CI with an SSL error

2021-03-08 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +vstinner

___
Python tracker 

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



[issue37146] opcode cache for LOAD_GLOBAL emits false alarm in memory leak hunting

2021-03-08 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 9f672a52f55ce198d5689b5771948350028b4a3b by Victor Stinner in 
branch 'master':
bpo-37146: Move _PyEval_DeactivateOpCache() to the internal C API (GH-24786)
https://github.com/python/cpython/commit/9f672a52f55ce198d5689b5771948350028b4a3b


--

___
Python tracker 

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



[issue43435] Py_BuildValue("y#".... returns incomplete result

2021-03-08 Thread David Wood


David Wood  added the comment:

Still no bueno.

--

___
Python tracker 

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



[issue43332] Make http.client._tunnel send one byte string over the network

2021-03-08 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

I only ported this back to 3.9 as it is a bit late in 3.8's release cycle for a 
pure performance fix of an issue that has been around for ages.

Thanks for raising the issue.  The main http code already did this, the tunnel 
proxy code path clearly hadn't gotten much love.

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



[issue43435] Py_BuildValue("y#".... returns incomplete result

2021-03-08 Thread Christian Heimes


Christian Heimes  added the comment:

Py_BuildValue("y#", output, count) is equivalent to 
PyBytes_FromStringAndSize(output, count). The function returns a copy of the 
input string as a new bytes object. It's very unlikely that the code is broken. 
It's been around for ages and it's a core feature.

--

___
Python tracker 

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



[issue43439] [security] Add audit events on GC functions giving access to all Python objects

2021-03-08 Thread Christian Heimes


Christian Heimes  added the comment:

> Note: if someone wants to address the ability to remove an audit hook, the 
> internal list can be modified to not be a Python object.

I wouldn't bother. There are other ways to modify data structures, e.g. poke 
into process memory.

--

___
Python tracker 

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



[issue43435] Py_BuildValue("y#".... returns incomplete result

2021-03-08 Thread David Wood


David Wood  added the comment:

Christian -

Thank you for this.  I did as you suggested however, I still have the same 
problem.  As I pointed out in my original message, the problem does not exist 
if I insert a sleep(1) statement prior to returning from the function.  
Additional to that, I previously had printf('.') statement in place of the 
sleep statement.  When I ran 10,000 iterations in python and printed my 
pass/fail totals, I still had a few hundred dots print which tells me that 
there has to be some sort of timing or buffer transfer issue between c and 
python.  Does that make sense?

--

___
Python tracker 

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



[issue43438] [doc] sys.addaudithook() documentation should be more explicit on its limitations

2021-03-08 Thread Christian Heimes


Christian Heimes  added the comment:

I agree with both of you.

The documention should explicitly state that the audit hooks are for auditing. 
They are not designed to sandbox Python. When used correctly, they can help to 
capture and analyze an event post-mortem.

The documentation of sys.addaudithook() should also mention that hooks may not 
trigger under some conditions, e.g. very late in the interpreter shutdown phase.

--

___
Python tracker 

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



[issue43427] Possible error on the descriptor howto guide

2021-03-08 Thread Raymond Hettinger


Change by Raymond Hettinger :


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

___
Python tracker 

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



[issue43438] [doc] sys.addaudithook() documentation should be more explicit on its limitations

2021-03-08 Thread Steve Dower


Steve Dower  added the comment:

To clarify my position on this (as the PEP author):

* audit hooks added *after* initialization (including via the Python API) are 
not intended for security, but for logging/debugging, and so bypasses are not 
considered security issues
* audit hooks added *before* Python is initialized should not be able to be 
bypassed *without* prior events indicating that a bypass is going to occur. 
Ways of bypassing/removing them without prior indicators should be reported as 
security issues

And note that all compile()d, imported or exec()d code should have been 
collected, which means any security bypass has to happen without arbitrary code 
execution.

These hooks are only one tool necessary to create a more secured environment, 
not the whole thing. (And note that I said "more secured" not "secure", because 
it's only as secure as you make it. The relative descriptor is deliberate.)

--

___
Python tracker 

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



[issue38033] Use After Free: PyObject_Free (valgrind)

2021-03-08 Thread STINNER Victor


STINNER Victor  added the comment:

It sounds like the reporter didn't use Valgrind properly. See last comments. If 
Valgrind still reports issues when it's used properly, please reopen the issue 
(or open a new issue). I close the issue for now.

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue43439] [security] Add audit events on GC functions giving access to all Python objects

2021-03-08 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> Rather than attempting to fix this specific vulnerability, I suggest to add 
> new audit events on the following gc functions:

Makes sense, I will prepare a PR today

--

___
Python tracker 

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



[issue43438] [doc] sys.addaudithook() documentation should be more explicit on its limitations

2021-03-08 Thread STINNER Victor


STINNER Victor  added the comment:

See also bpo-43439: [security] Add audit events on GC functions giving access 
to all Python objects.

--

___
Python tracker 

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



[issue43439] [security] Add audit events on GC functions giving access to all Python objects

2021-03-08 Thread STINNER Victor


New submission from STINNER Victor :

It is currently possible to discover the internal list of audit hooks using gc 
module functions, like gc.get_objects(), and so remove an audit hooks, whereas 
it is supposed to not be possible. The PEP 578 states: "Hooks cannot be removed 
or replaced."

Rather than attempting to fix this specific vulnerability, I suggest to add new 
audit events on the following gc functions:

* gc.get_objects()
* gc.get_referrers()
* gc.get_referents()

These functions are "dangerous" since they can expose Python objects in an 
inconsistent state. In the past, we add multiple bugs related to "internal" 
tuples which were not fully initialized (but already tracked by the GC). See 
bpo-15108 for an example.

Note: if someone wants to address the ability to remove an audit hook, the 
internal list can be modified to not be a Python object.

--
components: Library (Lib)
messages: 388300
nosy: christian.heimes, pablogsal, steve.dower, vstinner
priority: normal
severity: normal
status: open
title: [security] Add audit events on GC functions giving access to all Python 
objects
versions: Python 3.10

___
Python tracker 

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



[issue43438] [doc] sys.addaudithook() documentation should be more explicit on its limitations

2021-03-08 Thread STINNER Victor


New submission from STINNER Victor :

Recently, the PEP 578 audit hooks was used to build a Capture The Flag (CTF) 
security challenge, AntCTF x D^3CTF: https://d3ctf.io/

Multiple issues have been reported to the Python Security Response Team (PSRT) 
from this challenge. It seems like there was a misunderstanding on the intent 
of the PEP 578.

Building a sandbox using audit hooks is *explicitly* excluded from the PEP 578 
design:
https://www.python.org/dev/peps/pep-0578/#why-not-a-sandbox

See also the PEP 551 for more details.

The problem is that these two PEPs are not well summarized in the Python 
documentation, especially in the sys.addaudithook() documentation:
https://docs.python.org/dev/library/sys.html#sys.addaudithook

The documentation should better describe limitations of audit hooks, and may 
also point to these two PEPs for more information (PEP 578 is already 
mentioned).

The bare minimum should be to explicitly say that it should not be used to 
build a sandbox. 

By design, audit events is a whack a mole game. Rather than starting from a 
short "allow list", it is based on a "deny list", so it cannot be safe or 
complete by design. Every "forgotten" audit event can be "abused" to take the 
control on the application. And that's perfectly *fine*. It should just be 
documented.

--
assignee: docs@python
components: Documentation
messages: 388299
nosy: christian.heimes, docs@python, steve.dower, vstinner
priority: normal
severity: normal
status: open
title: [doc] sys.addaudithook() documentation should be more explicit on its 
limitations
versions: Python 3.10

___
Python tracker 

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



[issue19809] Doc: subprocess should warn uses on race conditions when multiple threads spawn child processes

2021-03-08 Thread Eryk Sun


Eryk Sun  added the comment:

>> PEP 443
>
> I guess that you mean the PEP 446 ;-)

Yes, that's why I meant :$

--

___
Python tracker 

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



[issue28356] [easy doc] Document os.rename() behavior on Windows when src and dst are on different filesystems

2021-03-08 Thread Eryk Sun


Eryk Sun  added the comment:

T-VEy, this is a documentation-only issue for versions of Python that are under 
active development for bug fixes and enhancements -- 3.8, 3.9, and 3.10.

--
versions: +Python 3.10, Python 3.8

___
Python tracker 

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



[issue42962] Windows: SystemError during os.kill(..., signal.CTRL_C_EVENT)

2021-03-08 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue27496] unicodedata.name() doesn't have names for control characters

2021-03-08 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue11361] [Windows] suggestion for os.kill(pid, CTRL_C_EVENT) in tests

2021-03-08 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner
title: suggestion for os.kill(pid,CTRL_C_EVENT) in tests -> [Windows] 
suggestion for os.kill(pid,CTRL_C_EVENT) in tests

___
Python tracker 

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



[issue28708] Low FD_SETSIZE limit on Windows

2021-03-08 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue43437] venv activate bash script has wrong line endings on windows

2021-03-08 Thread Eryk Sun


Eryk Sun  added the comment:

venv copies the scripts in binary mode, but apparently the Unix "activate" 
script already has CRLF line endings when Python is installed in Windows. 
Probably the POSIX "Lib/venv/scripts/common/activate" script needs a 
line-ending exception in ".gitattributes":

https://github.com/python/cpython/blob/master/.gitattributes

--
components: +Library (Lib)
nosy: +eryksun
versions: +Python 3.10, Python 3.9

___
Python tracker 

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



[issue25585] Bad path leads to: ImportError: DLL load failed: %1 is not a valid Win32 application.

2021-03-08 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue13559] Use sendfile where possible in httplib

2021-03-08 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue28356] [easy doc] Document os.rename() behavior on Windows when src and dst are on different filesystems

2021-03-08 Thread T-VEy


T-VEy  added the comment:

i have problem with python version 3.9.1

--
nosy: +scienidlex
versions:  -Python 3.10, Python 3.8

___
Python tracker 

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



[issue14678] Update zipimport to support importlib.invalidate_caches()

2021-03-08 Thread Brett Cannon


Change by Brett Cannon :


--
versions: +Python 3.10 -Python 3.8

___
Python tracker 

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



[issue14678] Update zipimport to support importlib.invalidate_caches()

2021-03-08 Thread Brett Cannon


Change by Brett Cannon :


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

___
Python tracker 

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



[issue14678] Update zipimport to support importlib.invalidate_caches()

2021-03-08 Thread miss-islington


miss-islington  added the comment:


New changeset 3abf6f010243a91bf57cbf357dac33193f7b8407 by Desmond Cheong in 
branch 'master':
bpo-14678: Update zipimport to support importlib.invalidate_caches() (GH-24159)
https://github.com/python/cpython/commit/3abf6f010243a91bf57cbf357dac33193f7b8407


--
nosy: +miss-islington

___
Python tracker 

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



[issue37146] opcode cache for LOAD_GLOBAL emits false alarm in memory leak hunting

2021-03-08 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +23552
pull_request: https://github.com/python/cpython/pull/24786

___
Python tracker 

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



[issue43427] Possible error on the descriptor howto guide

2021-03-08 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I can see how that section intro is a bit confusing.  Am thinking it will be 
more clear if the heading "Static Methods" is to moved to just after the table 
showing the three variants.  Otherwise, it looks like the intro text is talking 
specifically about static methods.

--

___
Python tracker 

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



[issue10653] test_time test_strptime fails on windows

2021-03-08 Thread Eryk Sun


Eryk Sun  added the comment:

> Eryk Sun: This issue is now closed. If you want to enhance 
> the time module, please open a new issue.

I was aware of that at the time, Victor. The problem can be worked on in a new 
issue, or in the older issue bpo-8304, which remains open. The two messages 
that I added are purely informative, to update my original comment in msg243660.

--

___
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

2021-03-08 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue8036] raise ValueError for empty `path` in os.spawnv[e]

2021-03-08 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue43359] Dead assignment in Py_UniversalNewlineFgets

2021-03-08 Thread STINNER Victor


STINNER Victor  added the comment:

> Hi Victor, just so we're all on the same page, removing the line does not 
> trigger a compiler warning. The comment on this line is misleading.

I wrote the opposite. IMO the line and its commment should be kept.

> Defect identified by scan-build 
> 

Just tell your tool that the line is there on purpose.

--

___
Python tracker 

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



[issue43233] test_os: test_copy_file_range_offset fails on FreeBSD CURRENT

2021-03-08 Thread STINNER Victor


STINNER Victor  added the comment:

It was a FreeBSD kernel bug. Kubilay Kocak reported it to Rick Macklem who 
fixed the FreeBSD kernel:
https://github.com/freebsd/freebsd-src/commit/a5f9fe2bab789f49e8b53da3a62dbd34725e23ea

--

___
Python tracker 

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



[issue43271] AMD64 Windows10 3.x crash with Windows fatal exception: stack overflow

2021-03-08 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks for the fix David Bolen ;-)

--

___
Python tracker 

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



[issue19809] Doc: subprocess should warn uses on race conditions when multiple threads spawn child processes

2021-03-08 Thread STINNER Victor


STINNER Victor  added the comment:

> PEP 443

I guess that you mean the PEP 446 ;-)

--

___
Python tracker 

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



[issue38119] resource tracker destroys shared memory segments when other processes should still have valid access

2021-03-08 Thread Álvaro Justen

Álvaro Justen  added the comment:

Based on changes at https://github.com/python/cpython/pull/15989 I've 
monkey-patched `multiprocessing.resource_tracker` so my current applications 
(running on Python 3.9.2) won't be affected. The code may be useful to others 
while the PR is not merged and we don't have a new release - you just need to 
call the `remove_shm_from_resource_tracker` function inside each Process target 
function.

- >8 -
from multiprocessing import resource_tracker


def remove_shm_from_resource_tracker():
"""Monkey-patch multiprocessing.resource_tracker so SharedMemory won't be 
tracked

More details at: https://bugs.python.org/issue38119
"""

def fix_register(name, rtype):
if rtype == "shared_memory":
return
return resource_tracker._resource_tracker.register(self, name, rtype)
resource_tracker.register = fix_register

def fix_unregister(name, rtype):
if rtype == "shared_memory":
return
return resource_tracker._resource_tracker.unregister(self, name, rtype)
resource_tracker.unregister = fix_unregister

if "shared_memory" in resource_tracker._CLEANUP_FUNCS:
del resource_tracker._CLEANUP_FUNCS["shared_memory"]
- 8< -

There's a working example in attached file `mprt_monkeypatch.py` (if you 
comment the function calls on lines 28 and 37 the warnings will be shown).

--
nosy: +turicas
Added file: https://bugs.python.org/file49859/mprt_monkeypatch.py

___
Python tracker 

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



[issue8304] time.strftime() and Unicode characters on Windows

2021-03-08 Thread Eryk Sun


Eryk Sun  added the comment:

> I'm not sure of what you mean. The function is implemented:

My comment was limited to Windows, for which time.tzset() has never been 
implemented. Since Python has its own implementation of time.tzname in Windows, 
it should also implement time.tzset() to allow refreshing the value. Actually, 
ucrt implements C _tzset(), so the implementation of time.tzset() in Windows 
also has to call C _tzset() to update _tzname (and also ucrt's new private 
__wide_tzname), in addition to calling GetTimeZoneInformation() to update its 
own time.tzname value. 

Another difference with Python's time.tzname and C strftime("%Z") is that  ucrt 
will use the TZ environment variable, but Python's implementation of 
time.tzname in Windows does not.

--

___
Python tracker 

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



[issue43427] Possible error on the descriptor howto guide

2021-03-08 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee: docs@python -> rhettinger

___
Python tracker 

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



[issue43436] bounded _lru_cache_wrapprer behaves as if typed=True when it wasn't

2021-03-08 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Thanks for the report, but this isn't a bug.

Setting typed=True guarantees that types are treated as distinct entries.

Setting typed=False means that the implementation MAY ignore the type and only 
use equality, but it is not required to do so.   If it is convenient for the 
implementation, it may use type to save space.  Currently int and str are 
treated as distinct from other types that may be equal to them.

Likewise, the implementation is allowed to treat different argument patterns as 
distinct even if they are equal.  Currently, we treat pow(2, 5) as distinct 
from pow(base=2, exp=5) which is itself distinct from pow(exp=5, base=2).

--
assignee:  -> rhettinger
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue43359] Dead assignment in Py_UniversalNewlineFgets

2021-03-08 Thread Alex Henrie


Alex Henrie  added the comment:

Hi Victor, just so we're all on the same page, removing the line does not 
trigger a compiler warning. The comment on this line is misleading.

--

___
Python tracker 

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



[issue43430] Exception raised when attempting to create Enum via functional API

2021-03-08 Thread Kamil Turek


Change by Kamil Turek :


--
nosy: +kamilturek

___
Python tracker 

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



[issue28712] Non-Windows mappings for a couple of Windows code pages

2021-03-08 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue28356] [easy doc] Document os.rename() behavior on Windows when src and dst are on different filesystems

2021-03-08 Thread STINNER Victor


STINNER Victor  added the comment:

This issue is now a matter of *documenting* the Windows behavior. Is there any 
volunteer to propose a PR?

--

___
Python tracker 

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



[issue28356] [easy doc] Document os.rename() behavior on Windows when src and dst are on different filesystems

2021-03-08 Thread STINNER Victor


Change by STINNER Victor :


--
keywords: +easy, newcomer friendly
title: Windows: os.rename different in python 2.7.12 and python 3.5.2 -> [easy 
doc] Document os.rename() behavior on Windows when src and dst are on different 
filesystems

___
Python tracker 

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



[issue43359] Dead assignment in Py_UniversalNewlineFgets

2021-03-08 Thread STINNER Victor


STINNER Victor  added the comment:

> c = 'x'; /* Shut up gcc warning */

IMHO this code is fine and should be kept. I hate fighting against stupid false 
alarms of compiler warnings. This code is harmless. It doesn't affect 
performances or anything.

I suggest to close this issue and its PR.

--

___
Python tracker 

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



[issue43427] Possible error on the descriptor howto guide

2021-03-08 Thread Kamil Turek


Kamil Turek  added the comment:

I think there isn't any error. Please look at the example provided in the guide:

class E:
@staticmethod
def f(x):
print(x)

>>> E.f(3)
3

If it were as you say, method would receive two arguments - f(E, 3) - which is 
wrong.

--
nosy: +kamilturek

___
Python tracker 

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



[issue43416] Add README files in Include/cpython and Include/internal

2021-03-08 Thread STINNER Victor


STINNER Victor  added the comment:

* Include/internal/ with extern: C API which must not and can not be used 
outside CPython code base, only stdlib extensions built as built-in extensions 
can use it.

* Include/internal/ with PyAPI_FUNC/PyAPI_DATA: API which should be be used 
outside CPython, but exposed for specific use cases like debuggers and 
profilers. Structures are exposed for debuggers and profilers which don't want 
to execute code to avoid the risk of any unwanted side effect.

* Include/cpython/: Public C API excluded from the limited C API 
(Py_LIMITED_API macro) and the stable ABI (PEP 384).

* Include/: Public limited C API and the stable ABI (PEP 384).

In case of doubt, new C API must be added to the internal C API using extern.

I would suggest a public discussion before adding any new C API to 
Include/cpython/ or Include/

No new functions stealing references or returning borrowed references must be 
added to public C API (limited or not). A strong reference must be returned.

--

___
Python tracker 

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



[issue36779] time.tzname returns empty string on Windows if default codepage is a Unicode codepage

2021-03-08 Thread STINNER Victor


Change by STINNER Victor :


--
resolution:  -> fixed

___
Python tracker 

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



[issue10653] test_time test_strptime fails on windows

2021-03-08 Thread STINNER Victor


STINNER Victor  added the comment:

Eryk Sun: This issue is now closed. If you want to enhance the time module, 
please open a new issue.

--

___
Python tracker 

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



[issue43422] Revert _decimal C API changes

2021-03-08 Thread STINNER Victor


STINNER Victor  added the comment:

I have a concern about the current _decimal C API: bpo-43060. I'm fine with 
removing it in Python 3.10, and add it back fixed in Python 3.11 or later.

> I can turn it into a PR but first I'd like to gather reactions here.

Go ahead.

--

___
Python tracker 

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



[issue8304] time.strftime() and Unicode characters on Windows

2021-03-08 Thread STINNER Victor


STINNER Victor  added the comment:

>  time.tzset() should be implemented

I'm not sure of what you mean. The function is implemented:

static PyObject *
time_tzset(PyObject *self, PyObject *unused)
{
PyObject* m;

m = PyImport_ImportModuleNoBlock("time");
if (m == NULL) {
return NULL;
}

tzset();

/* Reset timezone, altzone, daylight and tzname */
if (init_timezone(m) < 0) {
 return NULL;
}
Py_DECREF(m);
if (PyErr_Occurred())
return NULL;

Py_RETURN_NONE;
}

--

___
Python tracker 

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



[issue43437] venv activate bash script has wrong line endings on windows

2021-03-08 Thread Jeff Moguillansky


New submission from Jeff Moguillansky :

when running python.exe -m venv on Windows,
It creates several activate scripts.
The activate bash script has the wrong line endings (it should be unix-style, 
not windows-style).
Bash scripts should always end with unix style line endings

--
components: Windows
messages: 388276
nosy: jmoguill2, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: venv activate bash script has wrong line endings on windows
type: compile error
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



[issue43432] Add function `clear` to the `os` module

2021-03-08 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

If you write a flexible Text ui program, you should use functions provided by a 
text ui library which you use to clear the screen or a part of screen.

If you want to call an external command, use os.system(), os.popen() or more 
flexible subprocess module. But I do not think it will help with Text UI.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue43432] Add function `clear` to the `os` module

2021-03-08 Thread parsa mpsh


parsa mpsh  added the comment:

Well, some times we are writing a flexible Text ui program. we may use `clear` 
lot of times. This should be used when we haven't any valuable data on the 
screen. Also, who that uses this function, knows this will clear valuable data 
:). Sometimes also i use this command. but every time a should check that is 
this operation windows or not, to determine `clear` or `cls`. I think this is 
very helpful for making this easier.
The best feature of Python is its simplicity and power. More helper functions 
to make the code shorter and knowable, is a good thing for Python. Also about 
the Windows API instead of `cls`, i don't know more thing. But i think its not 
a big problem and `cls` works.

--

___
Python tracker 

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



[issue43435] Py_BuildValue("y#".... returns incomplete result

2021-03-08 Thread Christian Heimes


Christian Heimes  added the comment:

Does mcrypt_generic() output base64 or ASCII-only data? Since you are 
converting the output to bytes, I assume the output may contain any byte. In 
that case strcpy() is not safe. You have to use memcpy().

Fun fact: Nintendo had a similar bug many years ago, check out "trucha bug"

--

___
Python tracker 

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



[issue43431] Subprocess timeout causes output to be returned as bytes in text mode

2021-03-08 Thread Jordan Macdonald


Jordan Macdonald  added the comment:

Eryk Sun: Well, I think step 1 should be to update the documentation for Python 
3.7 through 3.10 on `subprocess.run()` and `subprocess.TimeoutExpired` to 
clearly state that `TimeoutExpired.stdout` and `TimeoutExpired.stderr` will be 
in bytes format even if text mode is set.

If we went with the model of having `stdout_bytes` and attempting to decode 
into `stdout`, we'd want an option to ignore a trailing decoding 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



[issue43436] bounded _lru_cache_wrapprer behaves as if typed=True when it wasn't

2021-03-08 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +rhettinger

___
Python tracker 

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



[issue43436] bounded _lru_cache_wrapprer behaves as if typed=True when it wasn't

2021-03-08 Thread Dan Snider


New submission from Dan Snider :

Isn't the point of setting typed=True to make it so that e.g. True doesn't 
register as a hit when there is already a cache entry for 1.0? Assuming that is 
the case, although this report specifically targets 3.8 I found no indication 
that what I believe is the cause of this has been fixed in the interim.

def test():
from functools import lru_cache
class No1:
__eq__ = 0 .__eq__
__hash__ = 0 .__hash__
class No2:
__eq__ = (0,).__contains__
def __hash__(self, /): return hash(0)
@lru_cache(256, typed=False)
def test(v): return [v]
test(No1()), test(No1()), test(0.0), test(0)

print(test.cache_info())
@lru_cache(256, typed=False)
def test(v): return [v]
test(No2()), test(No2()), test(0.0), test(0)
print(test.cache_info())


CacheInfo(hits=0, misses=4, maxsize=256, currsize=4)
CacheInfo(hits=2, misses=2, maxsize=256, currsize=2)

--
messages: 388271
nosy: bup
priority: normal
severity: normal
status: open
title: bounded _lru_cache_wrapprer behaves as if typed=True when it wasn't
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



[issue43435] Py_BuildValue("y#".... returns incomplete result

2021-03-08 Thread David Wood


David Wood  added the comment:

I have not gone to the extent of comparing the direct output against what 
python gets, although it appears to be incomplete.  The following is my encrypt 
function which has been used successfully for many years in a separate c 
program, so I have high confidence in it.

char * encryptBlowfishCfb(const char * inStr, Py_ssize_t *count, char * output, 
char * encrkey) {
MCRYPT td;
char IV[10];
int len, i;
char block_buffer[512];
time_t t;

srand((unsigned) time());
strcpy(IV, "");
for (i = 0 ; i < 8 ; i++ ) {
IV[i] =  mset[(rand() % 62)];
}
td = mcrypt_module_open(MCRYPT_BLOWFISH, NULL, MCRYPT_CFB, NULL);
mcrypt_generic_init(td, encrkey, strlen(encrkey), IV);
memset(block_buffer, 0, sizeof(block_buffer));
strcpy(block_buffer, inStr);
i = strlen(inStr);
mcrypt_generic(td, _buffer, i);
block_buffer[i] = '\0';
strcpy(_buffer[i], IV);
mcrypt_generic_deinit(td);
mcrypt_module_close(td);

len = i + 8 + 1;
memset(output, 0, 512);
strncpy(output, block_buffer, len -1);
*count = i + 8;

return output;
}

--

___
Python tracker 

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



[issue43435] Py_BuildValue("y#".... returns incomplete result

2021-03-08 Thread Christian Heimes


Christian Heimes  added the comment:

What do you mean by "incomplete"? Does it return less data or invalid data? 
Could you please paste your implementation of encryptBlowfishCfb(), too?

--
nosy: +christian.heimes

___
Python tracker 

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



[issue43435] Py_BuildValue("y#".... returns incomplete result

2021-03-08 Thread David Wood


New submission from David Wood :

I have a c function to encrypt values which returns an array of bytes.  The 
function returns proper values outside of python.  When used as a python 
function, the result is incomplete usually 10-20% of the time.  If I add a 
sleep(1) call before returning from the function, my success rate goes to 100%. 
 While this works, it is unacceptable as it will create enormous latency in my 
application.

static PyObject *method_encrypt(PyObject *self, PyObject *args) {
char *keyval, *str = NULL, output[512];
Py_ssize_t count=0;
PyObject *retval;

if(!PyArg_ParseTuple(args, "ss", , )) {
return NULL;
}

encryptBlowfishCfb(str, , output, keyval);

retval = Py_BuildValue("y#", output, count);
//sleep(1);
return retval;
}

--
components: C API
messages: 388268
nosy: dwoodjunkmail
priority: normal
severity: normal
status: open
title: Py_BuildValue("y#" returns incomplete result
type: performance
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



[issue43285] ftplib use host from PASV response

2021-03-08 Thread confd0


confd0  added the comment:

Any response here? If you need more information let me know.

--

___
Python tracker 

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



[issue43432] Add function `clear` to the `os` module

2021-03-08 Thread Eryk Sun


Eryk Sun  added the comment:

The idea of adding some kind of clear_screen() function in the os or shutil 
module was discussed extensively on python-ideas a few months ago:

https://mail.python.org/archives/list/python-id...@python.org/thread/EWQ2BOL3WVZAU2V2MT3HLXN3AEBHANNZ
https://mail.python.org/archives/list/python-id...@python.org/thread/N2G5MDPST6IMUQCK6LLAUOVIJIOOC2XJ

I would not want to clear the terminal scrollback buffer, in which case the 
implementation in Windows would need to use the console API and/or VT sequences 
instead of the CMD shell's CLS command.

--
nosy: +eryksun

___
Python tracker 

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



  1   2   >