[issue46613] Add PyType_GetModuleByDef to the public & limited API

2022-02-08 Thread Hai Shi


Change by Hai Shi :


--
nosy: +shihai1991

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



[issue46647] `test_functools` unexpected failures when C `_functoolsmodule` is missing

2022-02-07 Thread Hai Shi


Hai Shi  added the comment:

> _functoolsmodule is a core bootstrap module and defined in 
> Modules/Setup.bootstrap. It has no external dependencies. There is no reason 
> and no point to disable the module.

+1. 

> Cristian, in this case - is there a reason to keep `skipUnless(c_functools)` 
> around? 
> If we are sure that it is always available - then it should be always tested. 

Hm. Personally, I suggest to keep the `skipUnless` to aovid the code churn.
Or maybe you have other cases to show the functools module will missing 
unexpectly?

--

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



[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2022-01-19 Thread Hai Shi

Hai Shi  added the comment:

> If not, I'd like to close this (with apologies for not doing my research and 
> letting Hai Shi do unmerged work).
> If a use case is found, I suspect it'll need a different solution – perhaps 
> allowing PyType_Slot·s

OK, I close this bpo. We can reopen or create a new bpo if we find a useful 
user case. Thank you all for joining this bpo :)

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

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



[issue46368] faulthandler: add the ability to dump all interpreters, not only the current interpreter

2022-01-18 Thread Hai Shi


Change by Hai Shi :


--
nosy: +shihai1991

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



[issue46417] [subinterpreters] Clear static types in Py_Finalize()

2022-01-18 Thread Hai Shi


Change by Hai Shi :


--
nosy: +shihai1991

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



[issue45691] Partial moving of core objects to interpreter state is incorrect at best, unsafe at worse.

2022-01-18 Thread Hai Shi


Change by Hai Shi :


--
nosy: +shihai1991

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



[issue44133] Some C-API symbols (e.g. Py_FrozenMain) are not always exported

2021-12-01 Thread Hai Shi


Change by Hai Shi :


--
nosy: +shihai1991
nosy_count: 4.0 -> 5.0
pull_requests: +28101
pull_request: https://github.com/python/cpython/pull/29876

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



[issue44532] multi subinterpreters use _PyStructSequence_InitType failed.

2021-11-14 Thread Hai Shi


Hai Shi  added the comment:

OK,thanks. If it's just only interal calling, I don't think throwing a 
exception would break anything. As your pasted code shows, the modules have 
judeged the tp_name is inited or not.

--

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



[issue43588] [Subinterpreters]: use static variable under building Python with --with-experimental-isolated-subinterpreters cause crash.

2021-11-10 Thread Hai Shi


Change by Hai Shi :


--
nosy: +shihai1991

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



[issue45758] Crash on Py_DecRef'ing builtin object from previous run

2021-11-09 Thread Hai Shi


Hai Shi  added the comment:

Hi, Victor Milovanov. The memory allocated by interpreter will be freed after 
calling Py_Finalize().

--
nosy: +pablogsal, shihai1991

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



[issue45444] test.test_concurrent_futures fail in x86_ 64 architecture

2021-11-02 Thread Hai Shi


Hai Shi  added the comment:

> I use the Linux operating system (openeuler), kernel version 4.19.90, GCC 
> version 7.3.0. I directly run the following statement in the virtual machine

Hm. I haven't openeuler system, but I get docker container of the euler system.
The tests have passed in my docker containers(x86_64/aarch64).
My aarch64 systeminfo: Linux version 
4.19.36-vhulk1907.1.0.h1088.eulerosv2r8.aarch64 (abuild@szxrtosci1) (gcc 
version 7.3.0 (GCC)) #1 SMP Fri Aug 6 17:40:05 UTC 2021
build cmd: ./configure && make -j

and the output of `./python -m test.pythoninfo`:
test_socket.HAVE_SOCKET_ALG: True
test_socket.HAVE_SOCKET_BLUETOOTH: False
test_socket.HAVE_SOCKET_CAN: True
test_socket.HAVE_SOCKET_CAN_ISOTP: False
test_socket.HAVE_SOCKET_CAN_J1939: False
test_socket.HAVE_SOCKET_QIPCRTR: False
test_socket.HAVE_SOCKET_RDS: False
test_socket.HAVE_SOCKET_UDPLITE: True
test_socket.HAVE_SOCKET_VSOCK: False
test_support._is_gui_available: False

I checked the `test_socket.HAVE_SOCKET_QIPCRTR` and haven't find the 
correlation with test_concurrent_futures.py.

--

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



[issue45275] Make argparse print description of subcommand when invoke help doc on subcommand

2021-10-24 Thread Hai Shi


Hai Shi  added the comment:

Hi, Chuanlong. Would you mind to upload a demo for this question?

--
nosy: +shihai1991

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



[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-10-23 Thread Hai Shi


Hai Shi  added the comment:

> PEP 3121 is not withdrawn; PEP 630 is not withdrawn. What is then expected of 
> a new PEP? Or the other way around: what is missing from those two PEPs?

Thanks Erlend for the relative information you provided. AFAIK, the stdlib is 
not the extension module strictly :)

--

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



[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-10-20 Thread Hai Shi


Hai Shi  added the comment:

>Ah, sorry, I overlooked the flags.
 It's Okay.

>This does beg the question: what else from PyType_Spec will be needed?
I guess we don't want to allow additional slots/methods.
 +1.

>Also, note that converting the stdlib to heap types is suspended, pending a 
>PEP.
 Can I do something for this pending PEP?

> The Py_TPFLAGS_DISALLOW_INSTANTIATION is very specific; do you have other 
> examples that need this?
  I only find this bpo-44532 :( I guess the outside user will use it MAYBE.

--

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



[issue44532] multi subinterpreters use _PyStructSequence_InitType failed.

2021-10-20 Thread Hai Shi


Hai Shi  added the comment:

> In _PyStructSequence_InitType, it will check type is initialized.
  It's a internal C API :)

> when type already been initialized, should return 0 rather than throw 
> exception.
  The another solution is to check the type status before calling 
_PyStructSequence_InitType().

--
nosy: +shihai1991

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



[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-10-13 Thread Hai Shi


Hai Shi  added the comment:

> The only thing the proposed PR adds is a way to set ht_module, which actually 
> isn't very useful (it's used for module state access.

Hm, there have some static types. so I create the 
PyStructSequence_FromModuleAndDes() could receive tp_flags and try convert 
those static types to the heap type. eg: 
https://github.com/python/cpython/blob/main/Python/sysmodule.c#L2837-L2839
We can not do this converting operation by calling PyStructSequence_NewType(), 
no?

This is my *reason* to create PR-28573 :)

--

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



[issue45315] `PyType_FromSpec` does not copy the name

2021-10-06 Thread Hai Shi


Hai Shi  added the comment:

> the simplest solution is calling `type_set_name`, even if that runs some 
> unnecessary checks.

Hm, I haven't find any case who use dynamical tp_name of Type_Spec temporarily.
If we meet this user case, Adding a new object pointer of type name in is an 
other option maybe:)

--
nosy: +petr.viktorin, shihai1991

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



[issue45316] [C API] Functions not exported with PyAPI_FUNC()

2021-10-06 Thread Hai Shi


Change by Hai Shi :


--
nosy: +shihai1991

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



[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-09-26 Thread Hai Shi


Change by Hai Shi :


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

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



[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-09-25 Thread Hai Shi


Hai Shi  added the comment:

> More generally, this would need solving one of the remaining limitations of 
> the limited API (PEPs 489, 630): type-specific data.
Agree. We can't track and destroy the memory block created from the heap now.

--

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



[issue45127] Code objects can contain unmarshallable objects

2021-09-07 Thread Hai Shi


Change by Hai Shi :


--
nosy: +shihai1991

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



[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-09-06 Thread Hai Shi


Hai Shi  added the comment:

> But I encourage you to try, so you get a better understanding of the problem 
> :)

OK, thanks, Petr. I try to add this C API to see what will happen :)

--

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



[issue40512] [subinterpreters] Meta issue: per-interpreter GIL

2021-09-06 Thread hai shi


hai shi  added the comment:

bpo-45113: [subinterpreters][C API] Add a new function to create 
PyStructSequence from Heap.

--
versions: +Python 3.11 -Python 3.10

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



[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-09-06 Thread hai shi


New submission from hai shi :

Copied from https://bugs.python.org/issue40512#msg399847:

Victor: PyStructSequence_InitType2() is not compatible with subinterpreters: it 
uses static types. Moreover, it allocates tp_members memory which is not 
released when the type is destroyed. But I'm not sure that the type is ever 
destroyed, since this API is designed for static types.

> PyStructSequence_InitType2() is not compatible with subinterpreters: it uses 
> static types. Moreover, it allocates tp_members memory which is not released 
> when the type is destroyed. But I'm not sure that the type is ever destroyed, 
> since this API is designed for static types.

IMO, I suggest to create a new function, 
PyStructSequence_FromModuleAndDesc(module, desc, flags) to create a heaptype 
and don't aloocates memory block for tp_members,something like 
'PyType_FromModuleAndSpec()`.

--
components: C API
messages: 401129
nosy: petr.viktorin, shihai1991, vstinner
priority: normal
severity: normal
status: open
title: [subinterpreters][C API] Add a new function to create PyStructSequence 
from Heap.
versions: Python 3.11

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



[issue40512] [subinterpreters] Meta issue: per-interpreter GIL

2021-09-05 Thread hai shi


hai shi  added the comment:

> PyStructSequence_InitType2() is not compatible with subinterpreters: it uses 
> static types. Moreover, it allocates tp_members memory which is not released 
> when the type is destroyed. But I'm not sure that the type is ever destroyed, 
> since this API is designed for static types.

IMO, I suggest to create a new function, 
PyStructSequence_FromModuleAndDesc(module, desc, flags) to create a heaptype 
and don't aloocates memory block for tp_members,something like 
'PyType_FromModuleAndSpec()`.

I don't know there have any block issue to do this converting operation. But I 
can take a look.

@petr ping, Petr, do you have any better idea about this question :)

--
nosy: +petr.viktorin

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



[issue44359] test_ftplib fails as "env changes" if a socket operation times out in a thread: TimeoutError is not catched

2021-08-31 Thread hai shi


Change by hai shi :


--
nosy: +shihai1991

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



[issue45062] test_asyncio: test_huge_content_recvinto() failed on PPC64LE RHEL8 Refleaks 3.9

2021-08-31 Thread hai shi


Change by hai shi :


--
nosy: +shihai1991

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



[issue45020] Freeze all modules imported during startup.

2021-08-30 Thread hai shi


Change by hai shi :


--
nosy: +shihai1991

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



[issue45021] Race condition in thread.py

2021-08-30 Thread hai shi


hai shi  added the comment:

Is it a defined behavior?
I got this sentence from pep-3148: Deadlock can occur when the callable 
associated with a Future waits on the results of another Future.

--
nosy: +shihai1991

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



[issue44913] segfault in call to embedded PyModule_New

2021-08-23 Thread hai shi


hai shi  added the comment:

This bpo isn't a bug, so I close it now. If there are some enhancements need to 
be discussed, we can reopen it:)

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

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



[issue44913] segfault in call to embedded PyModule_New

2021-08-23 Thread hai shi


hai shi  added the comment:

> Or are you saying something can be done in Python's components to
handle this use case transparently? so the user won't have to put GIL
locks in his code.

Sorry, I don't explain it good enough. You have said what I wanted to say:)

> Yes, but if the extension is loaded into a C program (i.e. not from
python then the extension (libfoo1.so) has to call Py_Initialize at
that point.

You are right. I just only saw your dload.py, so I don't know how you start the 
python prcoess in your env;).
I haven't the experience of the pam-python:(.

--

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



[issue44913] segfault in call to embedded PyModule_New

2021-08-22 Thread hai shi


hai shi  added the comment:

> which can be wrapped within the calls to PyGILState_Ensure/Release.

OK, it's a good idea. But I think this enhancement will break the back 
compatibility.

> python is initialized within that entrypoint

python is initialized when you run python :)

--
type:  -> enhancement

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



[issue44913] segfault in call to embedded PyModule_New

2021-08-21 Thread hai shi


hai shi  added the comment:

How about this one?

int foo(void)
{
  printf(stderr, "foo BEGIN\n");
  if (!Py_IsInitialized()) {
fprintf(stderr, "python already initialized\n");
return -1;
  }
  const char *module_name = "foo";
  PyGILState_STATE state = PyGILState_Ensure();
  PyObject *module_handle = PyModule_New(module_name);
  if (module_handle == 0)
  {
fprintf(stderr,"PyModule_New(module_data_name=%s) failed\n",
module_name);
exit(1);
  }
  fprintf(stdout, "point is: %p\n", module_handle);
  fprintf(stderr, "foo END\n");
  PyGILState_Release(state);
  return 0;
}

--
nosy: +shihai1991

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



[issue30924] RPM build doc_files needs files separated into separate lines

2021-08-21 Thread hai shi


hai shi  added the comment:

> Should this be closed?
  Copy from PEP-632: In Python 3.10 and 3.11, distutils will be formally marked 
as deprecated. All known issues will be closed at this time.
  I close this bpo. If there have some block issues to discuss, we can reopen 
it again:)

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

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



[issue42035] [C API] PyType_GetSlot cannot get tp_name

2021-08-17 Thread hai shi


hai shi  added the comment:

> Now, I wonder if we should also introduce PyType_GetModuleName for 
> __module__, or stop and close this as fixed.

IMO, I suggest to close this bpo. We can get the `tp_name` by the C API now. If 
there have user want get `__module__`, we can open a new bpo to discuss :)

--

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



[issue44050] [subinterpreters] _PyImport_FixupExtensionObject() regression in Python 3.9

2021-08-17 Thread hai shi


hai shi  added the comment:

> (Note that the "def->m_size == -1" means that the module does not support 
> sub-interpreters, because it has global state.

Make Sense. It's more better and exact than my suggestion :)

--

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



[issue44050] [subinterpreters] _PyImport_FixupExtensionObject() regression in Python 3.9

2021-08-17 Thread hai shi


hai shi  added the comment:

> Maybe the old behavior was better: if an extension uses the old API, share 
> its state between all interpreters.

+1. I create PR-27794, which use `def->m_slots` to identify the extension 
module created from `PyModule_Create()` or not. cc @petr

--

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



[issue44050] [subinterpreters] _PyImport_FixupExtensionObject() regression in Python 3.9

2021-08-17 Thread hai shi


Change by hai shi :


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

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



[issue44865] [argparse] Missing translations

2021-08-08 Thread hai shi


Change by hai shi :


--
nosy: +paul.j3, rhettinger

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



[issue44864] [argparse] Do not translate user-provided strings in `ArgumentParser.add_subparsers()`

2021-08-08 Thread hai shi


Change by hai shi :


--
nosy: +paul.j3, rhettinger

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



[issue42035] [C API] PyType_GetSlot cannot get tp_name

2021-08-06 Thread hai shi


Change by hai shi :


--
pull_requests: +26143
pull_request: https://github.com/python/cpython/pull/27649

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



[issue42035] [C API] PyType_GetSlot cannot get tp_name

2021-08-02 Thread hai shi


hai shi  added the comment:

> - for the qualified name you can use `PyObject_GetAttrString(t, 
> "__qualname__")`

After PR-27551 merged, we can use PyType_GetQualName() to get type's 
`__qualname__`.

--

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



[issue42035] [C API] PyType_GetSlot cannot get tp_name

2021-08-02 Thread hai shi


Change by hai shi :


--
pull_requests: +26057
pull_request: https://github.com/python/cpython/pull/27551

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



[issue44748] argparse: a bool indicating if arg was encountered

2021-07-28 Thread hai shi


Change by hai shi :


--
nosy: +paul.j3, rhettinger

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



[issue44766] [easy doc] Remove redundant info in README.valgrind

2021-07-28 Thread hai shi


New submission from hai shi :

Objects/obmalloc.c hasn't use the Py_USING_MEMORY_DEBUGGER macro now. So this 
line can be deleted.
https://github.com/python/cpython/blob/31bec6f1b178dadec3cb43353274b4e958a8f015/Misc/README.valgrind#L17.

--
assignee: docs@python
components: Documentation
messages: 398411
nosy: docs@python, shihai1991
priority: normal
severity: normal
status: open
title: [easy doc] Remove redundant info in README.valgrind
type: enhancement
versions: Python 3.11

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



[issue42035] [C API] PyType_GetSlot cannot get tp_name

2021-07-27 Thread hai shi


hai shi  added the comment:

> - there is still no way to get t.tp_name
  Can we create PyType_GetDataSlot function to return the data pointer?

> If we go this way, why not add PyType_GetQualName as well?
  +1. I will create another PR after PR-23903 merged.

--

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



[issue43967] Valgrind memcheck on Py_Initialize

2021-07-25 Thread hai shi


hai shi  added the comment:

Hi, Simon. Thanks for your report.
There have an relatived issue in: bpo-43145, this bpo have mentioned  
`Py_Initialize()`. So I suggest to close this bpo. We can reopen it if we have 
seperated questions need to be discussed in here.

> Running a Valgrind memcheck of Py_Initialize still produces issues even when 
> using the suggested suppressions file. Am I doing something wrong or is this 
> expected?
AFAIK, You are right;)

--
nosy: +shihai1991
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed

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



[issue43145] Leak of locks from multiprocessing.Process

2021-07-24 Thread hai shi


hai shi  added the comment:

> The following locks are leaked:
> 1. 
> https://github.com/python/cpython/blob/196d4deaf4810a0bba75ba537dd40f2d71a5a634/Python/pystate.c#L78
> 2. 
> https://github.com/python/cpython/blob/196d4deaf4810a0bba75ba537dd40f2d71a5a634/Python/pystate.c#L84
> 3. 
> https://github.com/python/cpython/blob/196d4deaf4810a0bba75ba537dd40f2d71a5a634/Python/pystate.c#L90
> 4. https://github.com/python/cpython/blob/master/Python/ceval.c#L810
> 5. https://github.com/python/cpython/blob/master/Python/import.c#L126
> 6. and 7. 
> https://github.com/python/cpython/blob/master/Modules/_threadmodule.c#L597

Hi, Boris. Thanks for your report. We may receive the wrong alarm sometimes 
when we use valgrind.
 
1. 
https://github.com/python/cpython/blob/4512848ab92c8ed6aafb54d6e1908b1074558c43/Python/pystate.c#L78
   free in here: 
https://github.com/python/cpython/blob/196d4deaf4810a0bba75ba537dd40f2d71a5a634/Python/pystate.c#L127
2. https://github.com/python/cpython/blob/main/Python/ceval.c#L741
   free in here: 
https://github.com/python/cpython/blob/4512848ab92c8ed6aafb54d6e1908b1074558c43/Python/pystate.c#L375
3. 
https://github.com/python/cpython/blob/4512848ab92c8ed6aafb54d6e1908b1074558c43/Python/import.c#L124
4. free in here: 
https://github.com/python/cpython/blob/4512848ab92c8ed6aafb54d6e1908b1074558c43/Python/import.c#L156
5. 
https://github.com/python/cpython/blob/4512848ab92c8ed6aafb54d6e1908b1074558c43/Modules/_threadmodule.c#L613
   free in here: 
https://github.com/python/cpython/blob/4512848ab92c8ed6aafb54d6e1908b1074558c43/Modules/_threadmodule.c#L74
   To tihs refleak, I can't get the entire traceback of newobject. But I 
haven't get refleak when I run `./python -m test _test_multiprocessing -R 3:3 
-vv`.

--
nosy: +shihai1991
versions: +Python 3.11 -Python 3.10, Python 3.9
Added file: https://bugs.python.org/file50177/valgrind output.txt

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



[issue37224] [subinterpreters] test__xxsubinterpreters fails randomly

2021-07-19 Thread hai shi


Change by hai shi :


--
pull_requests: +25789
pull_request: https://github.com/python/cpython/pull/27240

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



[issue37224] [subinterpreters] test__xxsubinterpreters fails randomly

2021-07-19 Thread hai shi


hai shi  added the comment:

I use this add_printf_to_get_details_from_race_condition.patch to get some 
details of the running subinterpreter.

The successful output of test_already_running:
test_already_running (test.test__xxsubinterpreters.RunStringTests) ... In 
interp_create, the current state is: 0x23ee8f0
In interp_list_all, the current state is: 0x23ee8f0 # Entering _running().
Before interp runs, the current state is: 0x2489590 # Running the interp  in 
thread.
In interp_list_all, the current state is: 0x23ee8f0 # Running 
interpreters.list() in _running().
Before interp runs, the current state is: 0x23ee8f0 # Running the interp in 
test_already_running().
After interp runs, the current state is: 0x25cf0e0 # Running the interp in 
thread.
In interp_list_all, the current state is: 0x23ee8f0 # Clearing the created 
interps.

The failed output of test_already_running:
test_already_running (test.test__xxsubinterpreters.RunStringTests) ... In 
interp_create, the current state is: 0x23e58f0
In interp_list_all, the current state is: 0x23e58f0
In interp_list_all, the current state is: 0x23e58f0 # Compared to the 
successful output of test_already_running, the interp doesn't run in time. 
Before interp runs, the current state is: 0x23e58f0
spam
After interp runs, the current state is: 0x24fdfc0
In interp_list_all, the current state is: 0x23e58f0
FAIL

==
FAIL: test_already_running (test.test__xxsubinterpreters.RunStringTests)
--
Traceback (most recent call last):
  File "/home/shihai/cpython/Lib/test/test__xxsubinterpreters.py", line 835, in 
test_already_running
with self.assertRaises(RuntimeError):
AssertionError: RuntimeError not raised

--

Ran 123 tests in 71.968s

FAILED (failures=1, skipped=6)
Warning -- Uncaught thread exception: RuntimeError
Exception in thread Thread-8 (run):
Traceback (most recent call last):
  File "/home/shihai/cpython/Lib/threading.py", line 1009, in _bootstrap_inner
self.run()
^^
  File "/home/shihai/cpython/Lib/threading.py", line 946, in run
self._target(*self._args, **self._kwargs)
^
  File "/home/shihai/cpython/Lib/test/test__xxsubinterpreters.py", line 49, in 
run
interpreters.run_string(interp, dedent(f"""
RuntimeError: unrecognized interpreter ID 60
test test__xxsubinterpreters failed.


According to above details, there are several possible explanations:
1.Some race condition break the opcode execution order.
  I checked the eval function. I didn't find that any condition will disrupt 
the execution order.
2.The running thread hasn't get the GIL in time.
  "RuntimeError: unrecognized interpreter ID 60" proves that the interp has 
been executed in _running(), but later than the test_already_running. So I 
creates PR 26598. But I catch the error again with PR 26598.
3.the running thread can't get the time slice of CPU.
  By running python with add_printf_to_get_details_from_race_condition.patch, I 
find that the thread created in _running() has be executed, but the interp 
hasn't been executed immediately in run(). At the same time, the done.set() has 
been executed in run(), so I guess the real reason is the thread created in 
_running() hasn't get the time slice of CPU to run interp in run() in 
multiprocess.

Pls correct me if I am wrong.

--
Added file: 
https://bugs.python.org/file50160/add_printf_to_get_details_from_race_condition.patch

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



[issue37224] [subinterpreters] test__xxsubinterpreters fails randomly

2021-06-15 Thread hai shi


Change by hai shi :


--
pull_requests: +25320
pull_request: https://github.com/python/cpython/pull/26733

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



[issue37224] [subinterpreters] test__xxsubinterpreters fails randomly

2021-06-08 Thread hai shi


Change by hai shi :


--
pull_requests: +25182
pull_request: https://github.com/python/cpython/pull/26598

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



[issue37224] [subinterpreters] test__xxsubinterpreters fails randomly

2021-06-03 Thread hai shi


hai shi  added the comment:

OK, I try to take a look after Kyle leaves temporarily. But I haven't replicate 
this issue in my vm in recent days :(

--
nosy: +shihai1991
versions: +Python 3.11 -Python 3.8

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



[issue44263] Better explain the GC contract for PyType_FromSpecWithBases

2021-05-31 Thread hai shi


Change by hai shi :


--
nosy: +shihai1991

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



[issue42972] [C API] Heap types (PyType_FromSpec) must fully implement the GC protocol

2021-05-29 Thread hai shi


Change by hai shi :


--
pull_requests: +25045
pull_request: https://github.com/python/cpython/pull/26451

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



[issue42972] [C API] Heap types (PyType_FromSpec) must fully implement the GC protocol

2021-05-26 Thread hai shi


hai shi  added the comment:

> * functools._lru_list_elem
Looks like this type have performance in issue PR-5008 when supporting GC. I am 
not sure there have other similar questions or not.

--

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



[issue41111] [C API] Convert a few stdlib extensions to the limited C API (PEP 384)

2021-05-14 Thread hai shi


Change by hai shi :


--
versions: +Python 3.11 -Python 3.10

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



[issue41111] [C API] Convert a few stdlib extensions to the limited C API (PEP 384)

2021-05-14 Thread hai shi


hai shi  added the comment:

> METH_VARARGS and METH_KEYWORDS are part of the stable ABI.
  Copy that, thanks, petr.

--

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



[issue40938] urllib.parse.urlunsplit makes relative path to absolute (http:g -> http:///g)

2021-05-12 Thread hai shi


Change by hai shi :


--
nosy: +orsenthil

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



[issue41111] [C API] Convert a few stdlib extensions to the limited C API (PEP 384)

2021-05-12 Thread hai shi


hai shi  added the comment:

> The main limitation to use the limited C API for stdlib is Argument Clinic 
> which attempts to always emit the most efficient code, like using the 
> METH_FASTCALL calling convention and use private functions like 
> _PyArg_CheckPositional() or "static _PyArg_Parser _parser".

PR-26080 adds the feature that Argument Clinic to support to use the Limited C 
API.
METH_FASTCALL is the part of the stable ABI in PR-23009.
Do we need convert METH_VARARGS and METH_KEYWORDS as the part of the stable ABI 
too(something like METH_FASTCALL)?

--

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



[issue41111] [C API] Convert a few stdlib extensions to the limited C API (PEP 384)

2021-05-12 Thread hai shi


Change by hai shi :


--
pull_requests: +24719
pull_request: https://github.com/python/cpython/pull/26080

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



[issue37751] In codecs, function 'normalizestring' should convert both spaces and hyphens to underscores.

2021-04-24 Thread hai shi


hai shi  added the comment:

Thanks Marc-Andre for your supplement of PEP-100.
Thanks Inada, victor for your review and merge.

After PR-23096 merged, I suggest to close this bpo.
If there have any other questions, we can reopen it again.

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

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



[issue37751] In codecs, function 'normalizestring' should convert both spaces and hyphens to underscores.

2021-04-22 Thread hai shi


hai shi  added the comment:

>Ideally if we did not intend to break libraries then can this be fixed?
Or if it is acceptable to have such a breaking change.

Hi, akdor1154, thanks for your notice. It was a bugfix in fact:) 
https://bugs.python.org/issue37751#msg349448

> maybe this is https://github.com/python/cpython/pull/23096 ? though I would 
> not interpret that as a breaking change at first glance

@victor ping :)

--

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



[issue43908] array.array should remain immutable

2021-04-22 Thread hai shi


hai shi  added the comment:

> I would like this type (and other types that have been or will be converted 
> to heap types) to remain immutable.

  Hi, Guido. I am interested in what have been broken in fact? or it's a 
defined behavior?

> I think we may need a new flag bit meaning "built-in type, immutable". This 
> bit should not be inherited of course.
  
  Aggreed. Adding a new `tp_flag` is a lightweight solution.

--

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



[issue43845] test_concurrent_futures leaks many dangling threads on FreeBSD

2021-04-16 Thread hai shi


Change by hai shi :


--
nosy: +shihai1991

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



[issue37788] fix for bpo-36402 (threading._shutdown() race condition) causes reference leak

2021-04-11 Thread hai shi


hai shi  added the comment:

I created PR 25226. It's a another way to solve this problem.
Compared to PR 15175, `_set_sentinel()` don't need to receive any params :)

--

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



[issue43753] [C API] Add Py_Is(x, y) and Py_IsNone(x) functions

2021-04-06 Thread hai shi


Change by hai shi :


--
nosy: +shihai1991

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



[issue37788] fix for bpo-36402 (threading._shutdown() race condition) causes reference leak

2021-04-06 Thread hai shi


Change by hai shi :


--
nosy: +shihai1991
nosy_count: 12.0 -> 13.0
pull_requests: +23963
pull_request: https://github.com/python/cpython/pull/25226

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



[issue41111] [C API] Convert a few stdlib extensions to the limited C API (PEP 384)

2021-04-04 Thread hai shi


hai shi  added the comment:

> Perhaps it would be better that compiling them not be attempted with 
> configuring --with-trace-refs?

+1. The limited C API can't be build under Py_TRACE_REFS now.

--

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



[issue41111] [C API] Convert a few stdlib extensions to the limited C API (PEP 384)

2021-04-04 Thread hai shi


Change by hai shi :


--
pull_requests: +23922
pull_request: https://github.com/python/cpython/pull/25180

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



[issue4111] Add Systemtap/DTrace probes

2021-03-31 Thread hai shi


Change by hai shi :


--
pull_requests: +23865
pull_request: https://github.com/python/cpython/pull/25115

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



[issue41111] [C API] Convert a few stdlib extensions to the limited C API (PEP 384)

2021-03-31 Thread hai shi


hai shi  added the comment:

> By the way, maybe Py_LIMITED_API should be defined in xxlimited.c, rather 
> than in setup.py.

+1. Defining Py_LIMITED_API in xxlimited.c is more direct than in setup.py. so 
I created the PR-25115.

--

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



[issue4111] Add Systemtap/DTrace probes

2021-03-31 Thread hai shi


Change by hai shi :


--
pull_requests:  -23859

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



[issue41111] [C API] Convert a few stdlib extensions to the limited C API (PEP 384)

2021-03-31 Thread hai shi


Change by hai shi :


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

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



[issue4111] Add Systemtap/DTrace probes

2021-03-31 Thread hai shi


Change by hai shi :


--
nosy: +shihai1991
nosy_count: 25.0 -> 26.0
pull_requests: +23859
pull_request: https://github.com/python/cpython/pull/25115

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



[issue41551] test.support has way too many imports in libregrtest

2021-03-24 Thread hai shi


hai shi  added the comment:

bpo-41718

--

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



[issue41551] test.support has way too many imports in libregrtest

2021-03-24 Thread hai shi


hai shi  added the comment:

There have another related issue and have been fixed now in bpo 41718.
So I suggest to close this bpo.

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

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



[issue43554] email: encoded headers lose their quoting when refolded

2021-03-19 Thread hai shi


Change by hai shi :


--
nosy: +barry, maxking, r.david.murray

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



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

2021-03-18 Thread hai shi


Change by hai shi :


--
nosy: +shihai1991
nosy_count: 8.0 -> 9.0
pull_requests: +23686
pull_request: https://github.com/python/cpython/pull/24922

___
Python tracker 
<https://bugs.python.org/issue35134>
___
___
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-07 Thread hai shi


hai shi  added the comment:

+1 from me. 3.10.0 final haven't been released, so no one will be affected.

--
nosy: +shihai1991, vstinner

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



[issue43060] Convert _decimal C API from pointer array to struct

2021-03-03 Thread hai shi


hai shi  added the comment:

> True. Is there many external users of this API? I could not find any relevant 
> examples using searchcode.com.

Hm, many teams don't open their code, so we get check all user cases by 
searchcode web. So I have no any better sugesstion about it :(

--

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



[issue43060] Convert _decimal C API from pointer array to struct

2021-03-02 Thread hai shi


hai shi  added the comment:

> It is not "bad"; it is just more wordy.

Agree. Using sturct will be more easy check the members.

But converting the decimal c api may breaks the compatibility, because some 
macros like `PyDec_TypeCheck_INDEX` have been exposed in headers.

--

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



[issue43244] Move PyArena C API to the internal C API

2021-03-01 Thread hai shi


Change by hai shi :


--
keywords: +patch
nosy: +shihai1991
nosy_count: 1.0 -> 2.0
pull_requests: +23470
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24688

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



[issue43343] argparse.REMAINDER missing in online documentation for 3.9.x

2021-02-28 Thread hai shi


hai shi  added the comment:

Hi, Chigozirim Chukwu. Thanks for your report.

There have releated comment in: https://bugs.python.org/issue17050#msg315716

--
nosy: +paul.j3, rhettinger, shihai1991
versions: +Python 3.10

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



[issue43235] Tools/scripts/stable_abi.py should also check PC/python3dll.c (Windows stable ABI)

2021-02-24 Thread hai shi


hai shi  added the comment:

> It would be great to have a tool to check that all symbols exported on Unix 
> are also exported on Windows.

I write a demo in PR 24639(compare the stable_abi.dat to python3dll.c).
And the output result:
```
Some symbols from the limited API on windows are missing:
PyMarshal_WriteObjectToFile, PyThread_allocate_lock, PyObject_GC_IsFinalized, 
PyThread_ReInitTLS, PyThread_acquire_lock, PyThread_GetInfo, 
PyDictRevIterValue_Type, PyThread_get_thread_native_id, 
PyThread_start_new_thread, PyThread_set_stacksize, PyDictRevIterKey_Type, 
PyOS_AfterFork_Child, PyThread_create_key, PyThread_get_thread_ident, 
PyOS_BeforeFork, Py_BytesMain, PyThread_get_key_value, PyCodec_Unregister, 
PyInterpreterState_Get, PyMember_GetOne, PyThread_init_thread, 
PyInterpreterState_GetDict, PyThread_set_key_value, PyThread_delete_key, 
PyMarshal_WriteObjectToString, PyOS_AfterFork_Parent, 
PyThread_delete_key_value, PyObject_GC_IsTracked, 
PyMarshal_ReadObjectFromString, PyMarshal_WriteLongToFile, 
PyThread_exit_thread, PyThread_acquire_lock_timed, PyThread_get_stacksize, 
PyMember_SetOne, PyDictRevIterItem_Type, PyThread_free_lock, 
PyThread_release_lock

This error normally means that there are some missing symbols on windows.

Check if this was a mistake and if not, update the file containing the limited
API symbols. This file is located at:

PC/python3dll.c

You can read more about the limited API and its contracts at:

https://docs.python.org/3/c-api/stable.html

And in PEP 384:

https://www.python.org/dev/peps/pep-0384/

```

--

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



[issue43235] Tools/scripts/stable_abi.py should also check PC/python3dll.c (Windows stable ABI)

2021-02-24 Thread hai shi


Change by hai shi :


--
keywords: +patch
nosy: +shihai1991
nosy_count: 4.0 -> 5.0
pull_requests: +23424
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24639

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



[issue43278] unnecessary leading '\n' from Py_GetCompiler() when build with different complier

2021-02-21 Thread hai shi


hai shi  added the comment:

Maybe Guido can give you some answers.

Related commit: 
https://github.com/python/cpython/commit/f26cda62b68b68c07666f2f21b1f16ded03afa37.

--
nosy: +gvanrossum, shihai1991

___
Python tracker 
<https://bugs.python.org/issue43278>
___
___
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-02-21 Thread hai shi


Change by hai shi :


--
nosy: +giampaolo.rodola

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



[issue43250] [C API] Depreate or remove PyFPE_START_PROTECT() and PyFPE_END_PROTECT()

2021-02-21 Thread hai shi


hai shi  added the comment:

> So it doesn't sound like a good idea to immediately remove these two macros.

MAYBE we can update the annotation in pyfpe.h to address that we will remove 
those macros in python 4.0.

The fpe have been removed, so those macros will be removed finally.

--
nosy: +shihai1991

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



[issue43259] argparse: allow add_mutually_exclusive_group on add_argument_group

2021-02-18 Thread hai shi


Change by hai shi :


--
nosy: +paul.j3, rhettinger

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



[issue43239] PyCFunction_New is not exported with PyAPI_FUNC

2021-02-17 Thread hai shi


hai shi  added the comment:

>> PyCFunction_NewEx is part of the limited API as well, even though it's 
>> undocumented. People can call it.
>
>Wait no, I wrote too soon.
>PyCFunction_NewEx is part of the limited API as well, even though it's 
>>undocumented. People can call it.

Find some 3rd user calling this function in: 
https://searchcode.com/?q=PyCFunction_NewEx+. So I prefer to keep it too.
If calling `PyCFunction_New()` is better than `PyCFunction_NewEx()`, MAYBE we 
can add some description info in PR 24551.

--
nosy: +shihai1991

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



[issue43160] argparse: add extend_const action

2021-02-07 Thread hai shi


Change by hai shi :


--
nosy: +paul.j3

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



[issue42035] [C API] PyType_GetSlot cannot get tp_name

2021-02-01 Thread hai shi


hai shi  added the comment:

I found `type.__name__` has the implementation details in 
https://github.com/python/cpython/blob/master/Objects/typeobject.c#L486. 
IMHO, keep the consistency in `PyType_GetName()` is OK.

Victor, Petr. Do you think it make senses?

--

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



[issue43009] Port curses capi pointer array to a struct

2021-01-29 Thread hai shi


hai shi  added the comment:

> The _decimal API is also just an array of pointers. Should we change that to 
> a struct as well?

Hi, victor. Do you have suggestion about it :)

--

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



[issue43009] Port curses capi pointer array to a struct

2021-01-29 Thread hai shi


hai shi  added the comment:

> The _decimal API is also just an array of pointers. Should we change that to 
> a struct as well?

+1. IMHO, structure is more directly than pointer array. And there haven't 
exposing this pointer array to users(no backward compatibility).

--

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



[issue42979] _zoneinfo: zoneinfomodule_exec() doesn't check for PyDateTime_IMPORT failure

2021-01-27 Thread hai shi


hai shi  added the comment:

> It's already the case. Example

Nice, interesting case.

--

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



[issue42979] _zoneinfo: zoneinfomodule_exec() doesn't check for PyDateTime_IMPORT failure

2021-01-25 Thread hai shi


Change by hai shi :


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

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



[issue42979] _zoneinfo: zoneinfomodule_exec() doesn't check for PyDateTime_IMPORT failure

2021-01-23 Thread hai shi


hai shi  added the comment:

> If PyCapsule_Import() fails, zoneinfomodule_exec() returns 0 (success) with 
> an exception raised.

Why not return -1 directly when PyCapsule_Import() fails?
It looks like more simpler. Do I miss something?

--
nosy: +shihai1991

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



[issue41798] [C API] Revisit usage of the PyCapsule C API with multi-phase initialization API

2021-01-23 Thread hai shi


hai shi  added the comment:

I have checked all capi instances have been allocated in the heap memory.
So I think this bpo can be closed ;)

Thanks Erlend for your contribution.
Thanks victor, petr for your review

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

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



[issue43009] Port curses capi pointer array to a struct

2021-01-23 Thread hai shi


Change by hai shi :


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

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



  1   2   3   4   5   6   7   8   >