[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

[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/issu

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

[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

[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/issue34

[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/issue34

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

[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/issue34

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

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

[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

[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

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

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

[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/issu

[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

[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

[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/issue37

[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

[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/issue37

[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/issu

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

[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/issue36

[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/issue37

[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/issue34

[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

[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/issue37

[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/issue37

[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/issue35

[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/issue27

[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

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

[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/issu

[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

[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

[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: +hongw

[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/issue38

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

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

[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

[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

[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/issue38

[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

[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/issue26

[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.__

[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/issue38

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

[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/i

[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/issu

[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/i

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

[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/issu

[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/issue42

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

[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

[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/i

[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/issu

[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/i

[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/i

[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/issue38

[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/issu

[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/i

[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/issue26

[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/i

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

[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/issu

[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/issue33

[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/i

[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/issu

[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/i

[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). Bu

[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/issue40

[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/issu