[issue34410] itertools.tee not thread-safe; can segfault interpreter when wrapped iterator releases GIL

2018-09-05 Thread hongweipeng


hongweipeng  added the comment:

Multi-process need uses multiprocessing.Manager to share, the current problem 
should be tee-objcet thread safety issue.As Xiang Zhang said,`PyIter_Next` in 
`teedataobject_getitem` releases GIL.So the thread lock is necessary,and only 
lead iterator uses it when runs `PyIter_Next`.Can anyone help me review it.

--
nosy: +hongweipeng

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



[issue34410] itertools.tee not thread-safe; can segfault interpreter when wrapped iterator releases GIL

2018-09-05 Thread hongweipeng


Change by hongweipeng :


--
keywords: +patch
pull_requests: +8533
stage: needs patch -> patch review

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



[issue14156] argparse.FileType for '-' doesn't work for a mode of 'rb'

2018-09-09 Thread hongweipeng


Change by hongweipeng :


--
pull_requests: +8577
stage: test needed -> patch review

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



[issue34486] "RuntimeError: release unlocked lock" when starting a thread

2018-09-09 Thread hongweipeng


hongweipeng  added the comment:

It seems to me the problem is related to nested `finally` or `with`, which 
can't handle signals well.

class Event:
...
def wait(self, timeout=None):
self._cond.__enter__()
signaled = self._flag
if not signaled:
signaled = self._cond.wait(timeout)
self._cond.__exit__()
return signaled


Reducing one layer of nesting can solve this issue,but it can't pass `test` 
module.

--
nosy: +hongweipeng

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



[issue34475] functools.partial objects have no __qualname__ attribute

2018-09-09 Thread hongweipeng


hongweipeng  added the comment:

the functools.partial returns an instance not fun or cls.using 
`p.func.__qualname__` may be you want.

--
nosy: +hongweipeng

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



[issue34315] Regex not evalauated correctly

2018-09-11 Thread hongweipeng


hongweipeng  added the comment:

In my test in win2012r2, it works well. Add a screenshot.

--
nosy: +hongweipeng
Added file: https://bugs.python.org/file47794/win12r2py3.7.png

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



[issue31218] del expects __delitem__ if __setitem__ is defined

2018-10-16 Thread hongweipeng


Change by hongweipeng :


--
nosy: +hongweipeng

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



[issue34475] functools.partial objects have no __qualname__ attribute

2018-10-16 Thread hongweipeng


hongweipeng  added the comment:

partial() return an instance not class or function. Why it need __qualname__ 
attribute?

Ref: https://www.python.org/dev/peps/pep-3155/

--

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



[issue31553] Extend json.tool to handle jsonlines (with a flag)

2018-10-23 Thread hongweipeng


Change by hongweipeng :


--
pull_requests: +9389

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



[issue32291] Value error for string shared memory in multiprocessing

2018-09-29 Thread hongweipeng


Change by hongweipeng :


--
nosy: +hongweipeng

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



[issue32291] Value error for string shared memory in multiprocessing

2018-09-29 Thread hongweipeng


hongweipeng  added the comment:

This problem seems to be support for str.

import multiprocessing
import ctypes

def child_process_fun(share):
share.value = 'bb'

if __name__ == '__main__':
share = multiprocessing.Value(ctypes.c_wchar_p, 'aa')
process = multiprocessing.Process(target=child_process_fun, args=(share, ))
process.start()
process.join()
print(share.value)

It also raises ValueError.When use c_double or c_int, it works well.

Test in python3.7 and 3.8

--

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



[issue32291] Value error for string shared memory in multiprocessing

2018-09-29 Thread hongweipeng


hongweipeng  added the comment:

I think I know the reason. `c_wchar_p` corresponds to the string pointer 
`wchar_t *`.It's not a good idea to pass pointers between processes. As quoted 
from `multiprocessing` docs:

Note Although it is possible to store a pointer in shared memory remember that 
this will refer to a location in the address space of a specific process. 
However, the pointer is quite likely to be invalid in the context of a second 
process and trying to dereference the pointer from the second process may cause 
a crash.

https://docs.python.org/3.6/library/multiprocessing.html?#module-multiprocessing.sharedctypes

--

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



[issue35448] ConfigParser .read() - handling of nonexistent files

2018-12-10 Thread hongweipeng


Change by hongweipeng :


--
nosy: +hongweipeng

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



[issue34410] itertools.tee not thread-safe; can segfault interpreter when wrapped iterator releases GIL

2018-09-12 Thread hongweipeng


Change by hongweipeng :


--
pull_requests: +8685

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



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

2019-08-24 Thread hongweipeng


Change by hongweipeng :


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

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



[issue37935] Improve performance of pathlib.scandir()

2019-08-26 Thread hongweipeng


hongweipeng  added the comment:

Scandir() will be close when it iteration is over.You can see 
ScandirIterator_iternext:

```
static PyObject *
ScandirIterator_iternext(ScandirIterator *iterator)
{
while (1) {
...
}
/* Error or no more files */
ScandirIterator_closedir(iterator);
return NULL;
}
```

So, `entries = list(scandir(parent_path))` resources in this code can be 
properly closed.

--
nosy: +hongweipeng

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



[issue34410] itertools.tee not thread-safe; can segfault interpreter when wrapped iterator releases GIL

2019-08-30 Thread hongweipeng


hongweipeng  added the comment:

As far as I am concerned, I prefer that like PR 9254 can be merged into old 
versions. Because it does not break the legitimate code and can prevent the 
program from crashing. It can be used as a compatible solution with old 
versions.

--

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



[issue37953] Fix ForwardRef equality checks

2019-08-30 Thread hongweipeng


Change by hongweipeng :


--
pull_requests: +15296
pull_request: https://github.com/python/cpython/pull/15628

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



[issue38016] Results with re.sub and re.replace is giving different results

2019-09-03 Thread hongweipeng


hongweipeng  added the comment:

It's because ```re.sub('0.072', '72.0', newStringUpdated)``` match '03072' in 
-0.043'03072'77670375.

`.` can match any character in regular expression.So I don't think that's a 
issue.

--
nosy: +hongweipeng

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



[issue37806] Infinite recursion with typing.get_type_hints

2019-08-28 Thread hongweipeng


Change by hongweipeng :


--
pull_requests: +15232
pull_request: https://github.com/python/cpython/pull/15559

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



[issue37806] Infinite recursion with typing.get_type_hints

2019-08-25 Thread hongweipeng


Change by hongweipeng :


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

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



[issue35829] datetime: parse "Z" timezone suffix in fromisoformat()

2019-08-26 Thread hongweipeng


Change by hongweipeng :


--
nosy: +hongweipeng

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



[issue36946] Possible signed integer overflow in slice handling

2019-09-02 Thread hongweipeng


Change by hongweipeng :


--
pull_requests: +15305
pull_request: https://github.com/python/cpython/pull/15639

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



[issue37953] Fix ForwardRef equality checks

2019-09-02 Thread hongweipeng


Change by hongweipeng :


--
pull_requests: +15317
pull_request: https://github.com/python/cpython/pull/15650

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



[issue34410] itertools.tee not thread-safe; can segfault interpreter when wrapped iterator releases GIL

2019-08-28 Thread hongweipeng


Change by hongweipeng :


--
pull_requests: +15243
pull_request: https://github.com/python/cpython/pull/15567

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



[issue38105] hash collision when hash(x) == -2 causes many calls to __eq__

2019-09-11 Thread hongweipeng


hongweipeng  added the comment:

More than -2, -1 -4 -8 -16 and -32 will cause many calls to __eq__.In 
`set_add_entry` use

```
perturb >>= PERTURB_SHIFT;
i = (i * 5 + 1 + perturb) & mask;
```
get the next index.In the example,mask is 7,perturb is -2. If i = 6, after 
execution, the value of i has not changed.We can do one more verification like:
```
do {
perturb >>= PERTURB_SHIFT;
} while (i == ((i * 5 + 1 + perturb) & mask));
i = (i * 5 + 1 + perturb) & mask;
```
Of course this requires tests.

--
nosy: +hongweipeng

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



[issue37806] Infinite recursion with typing.get_type_hints

2019-09-13 Thread hongweipeng


hongweipeng  added the comment:

This report can be closed, PR #15400 has solved this issue.

--
nosy: +hongweipeng

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



[issue37806] Infinite recursion with typing.get_type_hints

2019-09-13 Thread hongweipeng


hongweipeng  added the comment:

Sorry, the link is https://github.com/python/cpython/pull/15400 .

--

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



[issue35696] remove unnecessary operation in long_compare()

2019-09-14 Thread hongweipeng


Change by hongweipeng :


--
pull_requests: +15756
pull_request: https://github.com/python/cpython/pull/16146

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



[issue27145] long_add and long_sub might return a new int where _ints[x] could be returned

2019-09-06 Thread hongweipeng


Change by hongweipeng :


--
pull_requests: +15370
pull_request: https://github.com/python/cpython/pull/15716

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



[issue37402] Fatal Python error: Cannot recover from stack overflow issues on Python 3.6 and 3.7

2019-09-05 Thread hongweipeng


hongweipeng  added the comment:

According to the provided text.py file. `__exit__` will always execute due to 
the `with` syntax. It looks like this:
```
def rec():
try:
rec()
except RecursionError:
rec()

rec()
```

--
nosy: +hongweipeng

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



[issue35696] remove unnecessary operation in long_compare()

2019-09-21 Thread hongweipeng


Change by hongweipeng :


--
nosy: +hongweipeng

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



[issue38290] cleanup ababstractproperty in typing.py

2019-09-27 Thread hongweipeng


Change by hongweipeng :


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

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



[issue38290] cleanup ababstractproperty in typing.py

2019-09-27 Thread hongweipeng


New submission from hongweipeng :

`abc.ababstractproperty` was deprecated since version 3.3. 
https://docs.python.org/3/library/abc.html#abc.abstractproperty

I checked the code and found that only `typing.py` is still used. I created a 
PR and replaced it with the one written in the documentation.

--
components: Library (Lib)
messages: 353348
nosy: hongweipeng
priority: normal
severity: normal
status: open
title: cleanup ababstractproperty in typing.py
versions: Python 3.9

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



[issue38251] urllib.request memory leak / overflow

2019-09-23 Thread hongweipeng


hongweipeng  added the comment:

My Windows 10 (64bit). There is no such problem in 3.6.1, but 3.7.0 has. And 
when requesting `http://...`, both of them are normal.

By the way, the related issues are all closed, is it supposed to reopen one?

--

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



[issue38302] __rpow__ not reached when __ipow__ returns NotImplemented

2019-09-29 Thread hongweipeng

hongweipeng  added the comment:

The document 
says(https://docs.python.org/3.9/reference/datamodel.html?highlight=__rpow__#object.__rpow__):
>Note that ternary pow() will not try calling __rpow__() (the coercion rules 
>would become too complicated).

--
nosy: +hongweipeng

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



[issue38045] enum.Flag instance creation is slow

2019-09-29 Thread hongweipeng


Change by hongweipeng :


--
pull_requests: +16068
pull_request: https://github.com/python/cpython/pull/16483

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



[issue38302] __rpow__ not reached when __ipow__ returns NotImplemented

2019-09-30 Thread hongweipeng


hongweipeng  added the comment:

Oh, I see. Thank you.

--

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



[issue38251] urllib.request memory leak / overflow

2019-09-22 Thread hongweipeng


Change by hongweipeng :


--
nosy: +hongweipeng

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



[issue38524] functools.cached_property is not supported for setattr

2019-10-19 Thread hongweipeng


New submission from hongweipeng :

```
from functools import cached_property
def age(self):
return 10
class A:
def __init__(self):
setattr(self.__class__, 'age', property(age))
setattr(self.__class__, 'age3', cached_property(age))

age2 = cached_property(age)

a = A()
print(a.age)# 10
print(a.age2)   # 10
print(a.age3)   # TypeError: Cannot use cached_property instance without 
calling __set_name__
```
Is it expected?

--
messages: 354929
nosy: hongweipeng
priority: normal
severity: normal
status: open
title: functools.cached_property is not supported for setattr
versions: Python 3.8

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



[issue38524] functools.cached_property is not supported for setattr

2019-10-19 Thread hongweipeng


hongweipeng  added the comment:

Is it possible to add an attrname parameter? It is more convenient to use.

class cached_property:
def __init__(self, func, attrname=None):
self.attrname = attrname
...

cls.age3 = cached_property(age, 'age3')

--

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



[issue38553] Document functools.cached_property supports value updating and clearing

2019-10-21 Thread hongweipeng


hongweipeng  added the comment:

It can be solved by extending propery. `class cached_property(property):` . How 
about this idea?

--
nosy: +hongweipeng

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



[issue38337] inspect: getmembers calls properties

2019-10-03 Thread hongweipeng


hongweipeng  added the comment:

The results of this example are different from mine(version 3.7.4).
```
__init__
--- getmembers from instance ---
Access property
[('__class__', ), ... ('var', 'Hello')]
--- getmembers from class---
[('__class__', ),'var', )]
```

--
nosy: +hongweipeng

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



[issue26103] Contradiction in definition of "data descriptor" between (dotted lookup behavior/datamodel documentation) and (inspect lib/descriptor how-to)

2019-10-08 Thread hongweipeng


Change by hongweipeng :


--
pull_requests: +16228
pull_request: https://github.com/python/cpython/pull/16645

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



[issue28869] __module__ attribute is not set correctly for a class created by direct metaclass call

2019-10-09 Thread hongweipeng


hongweipeng  added the comment:

I think we can refer to typing.py, it does not have this issue.

>>> from typing import NamedTuple
>>> A = NamedTuple('A', [('name', str), ('id', int)])
>>> class B(NamedTuple):
...   name: str
...   id: int
... 
>>> A.__module__
'__main__'
>>> B.__module__
'__main__'


It uses `nm_tpl.__module__ = sys._getframe(2).f_globals.get('__name__', 
'__main__')`.

--
nosy: +hongweipeng

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



[issue38337] inspect: getmembers calls properties

2019-10-03 Thread hongweipeng


hongweipeng  added the comment:

I mean why member `__class__` is expected to be `)`. 
I check PR16521,for __class__, it always gets `)`.

--

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



[issue39451] enum.Enum reference count leaks

2020-02-09 Thread hongweipeng


Change by hongweipeng :


--
nosy: +hongweipeng

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



[issue39942] Making instance of `TypeVar` fails because of missing `__name__`

2020-04-20 Thread hongweipeng


Change by hongweipeng :


--
keywords: +patch
nosy: +hongweipeng
nosy_count: 1.0 -> 2.0
pull_requests: +18948
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/19616

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



[issue40025] enum: _generate_next_value_ is not called if its definition occurs after calls to auto()

2020-05-04 Thread hongweipeng


Change by hongweipeng :


--
nosy: +hongweipeng
nosy_count: 9.0 -> 10.0
pull_requests: +19219
pull_request: https://github.com/python/cpython/pull/19904

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



[issue30533] missing feature in inspect module: getmembers_static

2020-06-16 Thread hongweipeng


Change by hongweipeng :


--
keywords: +patch
nosy: +hongweipeng
nosy_count: 5.0 -> 6.0
pull_requests: +20093
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/20911

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



[issue40873] Something wrong with html.unescape()

2020-06-19 Thread hongweipeng


Change by hongweipeng :


--
nosy: +hongweipeng

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



[issue42006] Stop using PyDict_GetItem, PyDict_GetItemString and _PyDict_GetItemId

2020-11-23 Thread hongweipeng


Change by hongweipeng :


--
nosy: +hongweipeng
nosy_count: 2.0 -> 3.0
pull_requests: +22374
pull_request: https://github.com/python/cpython/pull/23487

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



[issue42550] re库匹配问题

2020-12-02 Thread hongweipeng


hongweipeng  added the comment:

Maybe you need use `eth_re.match(a, re.MULTILINE)` or `eth_re.fullmatch(a)` .

--
nosy: +hongweipeng

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



[issue42609] Eval with too high string multiplication crashes newer Python versions

2020-12-11 Thread hongweipeng


Change by hongweipeng :


--
nosy: +hongweipeng

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



[issue42319] The `functools.singledispatchmethod` example in the document cannot run

2020-11-11 Thread hongweipeng


New submission from hongweipeng :

https://docs.python.org/zh-cn/3.8/library/functools.html#functools.singledispatchmethod

as the code:
```
from functools import singledispatchmethod

class Negator:
@singledispatchmethod
@classmethod
def neg(cls, arg):
raise NotImplementedError("Cannot negate a")

@neg.register
@classmethod
def _(cls, arg: int):
return -arg

@neg.register
@classmethod
def _(cls, arg: bool):
return not arg

```

  File "/root/.pyenv/versions/3.8.5/lib/python3.8/functools.py", line 907, in 
register
return self.dispatcher.register(cls, func=method)
  File "/root/.pyenv/versions/3.8.5/lib/python3.8/functools.py", line 849, in 
register
raise TypeError(
TypeError: Invalid first argument to `register()`: . Use either `@register(some_class)` or plain `@register` on an 
annotated function.

--
assignee: docs@python
components: Documentation
messages: 380741
nosy: docs@python, hongweipeng
priority: normal
severity: normal
status: open
title: The `functools.singledispatchmethod` example in the document cannot run
versions: Python 3.8

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



[issue42319] The `functools.singledispatchmethod` example in the document cannot run

2020-11-12 Thread hongweipeng


hongweipeng  added the comment:

Thanks,so close this one due to duplicate issue.

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

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



[issue42319] The `functools.singledispatchmethod` example in the document cannot run

2020-11-11 Thread hongweipeng


Change by hongweipeng :


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

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



[issue32218] add __iter__ to enum.Flag members

2020-11-18 Thread hongweipeng


Change by hongweipeng :


--
nosy: +hongweipeng
nosy_count: 5.0 -> 6.0
pull_requests: +22261
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/23368

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



[issue40897] Inheriting from class that defines __new__ causes inspect.signature to always return (*args, **kwargs) for constructor

2020-11-17 Thread hongweipeng


Change by hongweipeng :


--
keywords: +patch
nosy: +hongweipeng
nosy_count: 6.0 -> 7.0
pull_requests: +5
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/23336

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



[issue38085] Interrupting class creation in __init_subclass__ may lead to incorrect isinstance() and issubclass() results

2020-11-16 Thread hongweipeng


hongweipeng  added the comment:

Class `Triffid` failed to create in `__init_subclass__`, so 
`Triffid._abc_cache` uses its base class `_abc_cache`.

--
nosy: +hongweipeng

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



[issue30533] missing feature in inspect module: getmembers_static

2021-12-01 Thread hongweipeng


Change by hongweipeng :


--
pull_requests: +28100
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/29874

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



[issue43118] inspect.signature() raises RuntimeError on failed to resolve the default argument value

2021-12-28 Thread hongweipeng


Change by hongweipeng :


--
nosy: +hongweipeng
nosy_count: 1.0 -> 2.0
pull_requests: +28499
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30285

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



[issue26577] inspect.getclosurevars returns incorrect variable when using class member with the same name as other variable

2021-12-18 Thread hongweipeng


hongweipeng  added the comment:

Why is expected that 'x' would not exist in cv.globals? I think it works 
normally, you can see `x` in `func.__globals__`.

--
nosy: +hongweipeng

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



[issue42943] singledispatchmethod should expose registry of all known overloads

2021-12-09 Thread hongweipeng


Change by hongweipeng :


--
keywords: +patch
nosy: +hongweipeng
nosy_count: 5.0 -> 6.0
pull_requests: +28231
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30007

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



[issue46103] inspect.getmembers will call the instance __bases__ attribute, which may cause an exception

2021-12-16 Thread hongweipeng


New submission from hongweipeng :

root@debian:/workspace/cpython# ./python
Python 3.11.0a3+ (heads/main-dirty:b123ad8030, Dec 16 2021, 06:16:15) [GCC 
10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import inspect
>>> class Foo:
...   def __getattr__(self, attr):
... return None
... 
>>> inspect.getmembers(Foo())
Traceback (most recent call last):
  File "", line 1, in 
  File "/workspace/cpython/Lib/inspect.py", line 488, in getmembers
return _getmembers(object, predicate, getattr)
   ^^^
  File "/workspace/cpython/Lib/inspect.py", line 455, in _getmembers
for base in object.__bases__:
^
TypeError: 'NoneType' object is not iterable

--
components: Library (Lib)
messages: 408717
nosy: hongweipeng
priority: normal
severity: normal
status: open
title: inspect.getmembers will call the instance __bases__ attribute, which may 
cause an exception
type: behavior
versions: Python 3.11

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



[issue46103] inspect.getmembers will call the instance __bases__ attribute, which may cause an exception

2021-12-16 Thread hongweipeng


Change by hongweipeng :


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

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



[issue33632] undefined behaviour: signed integer overflow in threadmodule.c

2021-12-05 Thread hongweipeng


hongweipeng  added the comment:

I think PR https://github.com/python/cpython/pull/28674 has resolved this issue.

--
nosy: +hongweipeng

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



[issue42918] Nested multi-line expression will lead to "compile()" fails

2021-12-05 Thread hongweipeng


Change by hongweipeng :


--
keywords: +patch
nosy: +hongweipeng
nosy_count: 4.0 -> 5.0
pull_requests: +28158
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/29934

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



[issue38085] Interrupting class creation in __init_subclass__ may lead to incorrect isinstance() and issubclass() results

2021-12-15 Thread hongweipeng


Change by hongweipeng :


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

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



[issue44618] inspect.signature does not work for datetime classes

2021-07-16 Thread hongweipeng


Change by hongweipeng :


--
keywords: +patch
nosy: +hongweipeng
nosy_count: 2.0 -> 3.0
pull_requests: +25721
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/27177

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



[issue40897] Inheriting from class that defines __new__ causes inspect.signature to always return (*args, **kwargs) for constructor

2021-07-16 Thread hongweipeng


hongweipeng  added the comment:

>>> from datetime import timedelta as a
>>> from _datetime import timedelta as b
>>> a is b
True
>>>

`timedelta` is a C-level class, so inspect.signature(timedelta) is the same 
with inspect.signature(int).

But `signature` allow C-level function such as `inspect.signature(len)`, I 
think one way to improve is to use the C-level function when the python-level 
function cannot be found.

--

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



[issue40897] Inheriting from class that defines __new__ causes inspect.signature to always return (*args, **kwargs) for constructor

2021-07-16 Thread hongweipeng


Change by hongweipeng :


--
pull_requests: +25714
pull_request: https://github.com/python/cpython/pull/27177

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



[issue45756] mock raises exception when using a spec with an attribute that raises exception on access

2022-02-14 Thread hongweipeng


Change by hongweipeng :


--
nosy: +hongweipeng
nosy_count: 5.0 -> 6.0
pull_requests: +29497
pull_request: https://github.com/python/cpython/pull/31348

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