[Python-Dev] Re: _Py_Identifier should support non-ASCII string?

2019-06-20 Thread Inada Naoki
ariable named like PyId_foo, but all usage in CPython uses ASCII only, and _Py_Identifier is still private. -- Inada Naoki ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.pytho

[Python-Dev] Re: _Py_Identifier should support non-ASCII string?

2019-06-20 Thread Inada Naoki
On Fri, Jun 21, 2019 at 1:28 AM Victor Stinner wrote: > > Le jeu. 20 juin 2019 à 11:15, Inada Naoki a écrit : > > Can we change _PyUnicode_FromId to use _PyUnicode_FromASCII? > > How would a developer detect a mistake (non-ASCII) character? Does > _PyUnicode_FromASCII() rai

[Python-Dev] Re: _Py_Identifier should support non-ASCII string?

2019-06-20 Thread Inada Naoki
hon. So I wanted to discuss we really need to support non-ASCII before that. But it seems I was late already. -- Inada Naoki ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.p

[Python-Dev] Re: _Py_Identifier should support non-ASCII string?

2019-06-21 Thread Inada Naoki
OK. I start optimizing PyUnicode_GetString() already. It was 2x slower than _PyUnicode_FromASCII. But it can be only 1.5x slower than _PyUnicode_FromASCII. And as a bonus, `b"foo".decode()` become 10% faster too. -- Inada Naoki ___

[Python-Dev] Re: PyAPI_FUNC() is needed to private APIs?

2019-07-01 Thread Inada Naoki
ibuting generated C source code instead of a binary wheel or Cython source code. Regards, -- Inada Naoki ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.o

[Python-Dev] Re: obmalloc (was Have a big machine and spare time? Here's a possible Python bug.)

2019-07-04 Thread Inada Naoki
On Tue, Jun 25, 2019 at 5:49 AM Antoine Pitrou wrote: > > > For the record, there's another contender in the allocator > competition now: > https://github.com/microsoft/mimalloc/ > > Regards > > Antoine. It's a very strong competitor! $ ./python -m pyperf compare_to pymalloc.json mimalloc.json -

[Python-Dev] Re: obmalloc (was Have a big machine and spare time? Here's a possible Python bug.)

2019-07-04 Thread Inada Naoki
20.8 kB -> 66.5 MB +- 21.1 kB: 1.07x slower (+7%) - python_startup: 7946.6 kB +- 20.4 kB -> 8210.2 kB +- 16.6 kB: 1.03x slower (+3%) - python_startup_no_site: 7409.0 kB +- 18.3 kB -> 7574.6 kB +- 21.8 kB: 1.02x slower (+2%) ``` -- Inada Naoki _

[Python-Dev] Re: obmalloc (was Have a big machine and spare time? Here's a possible Python bug.)

2019-07-04 Thread Inada Naoki
MB ... -- Inada Naoki ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives

[Python-Dev] Re: obmalloc (was Have a big machine and spare time? Here's a possible Python bug.)

2019-07-08 Thread Inada Naoki
On Thu, Jul 4, 2019 at 11:32 PM Inada Naoki wrote: > > On Thu, Jul 4, 2019 at 8:09 PM Antoine Pitrou wrote: > > > > Ah, interesting. Were you able to measure the memory footprint as well? > > > > Hmm, it is not good. mimalloc uses MADV_FREE so it may affect to s

[Python-Dev] Re: obmalloc (was Have a big machine and spare time? Here's a possible Python bug.)

2019-07-09 Thread Inada Naoki
have been wrapped > around obmalloc over the years are to blame? Perhaps mimalloc's > larger (16x) pools and arenas let it stay in its fastest paths more > often? I don't know why, but it would be interesting to find out :-) Totally agree. I'll investigate this next. Regards

[Python-Dev] Optimizing pymalloc (was obmalloc

2019-07-09 Thread Inada Naoki
On Tue, Jul 9, 2019 at 5:29 PM Inada Naoki wrote: > > On Tue, Jul 9, 2019 at 9:46 AM Tim Peters wrote: > > > >> I was more intrigued by your first (speed) comparison: > > > > > - spectral_norm: 202 ms +- 5 ms -> 176 ms +- 3 ms: 1.15x faster (-13%) > >

[Python-Dev] Re: Optimizing pymalloc (was obmalloc

2019-07-10 Thread Inada Naoki
On Wed, Jul 10, 2019 at 5:18 PM Neil Schemenauer wrote: > > On 2019-07-09, Inada Naoki wrote: > > PyObject_Malloc inlines pymalloc_alloc, and PyObject_Free inlines > > pymalloc_free. > > But compiler doesn't know which is the hot part in pymalloc_alloc and >

[Python-Dev] Re: Optimizing pymalloc (was obmalloc

2019-07-10 Thread Inada Naoki
> Mean +- std dev: [python-master] 199 ms +- 1 ms -> [python] 182 ms +- > 4 ms: 1.10x faster (-9%) ... > I will try to split pymalloc_alloc and pymalloc_free to smaller functions. I did it and pymalloc is now as fast as mimalloc. $ ./python bm_spectral_norm.py --compare-to=./python-master python-

[Python-Dev] Re: Long-term deprecation policy

2019-07-16 Thread Inada Naoki
evs here. > FWIW, there is PendingDeprecationWarning for something discouraged but not deprecated, and will be deprecated in the future. But I prefer simple deprecation. Regards, -- Inada Naoki ___ Python-Dev mailing list -- python-dev@py

[Python-Dev] Re: Long-term deprecation policy

2019-07-17 Thread Inada Naoki
On Tue, Jul 16, 2019 at 11:07 PM Jeroen Demeyer wrote: > > On 2019-07-16 15:33, Inada Naoki wrote: > >> We currently have a deprecation policy saying that functions deprecated > >> in version N cannot be removed before version N+2. That's a reasonable > >&g

[Python-Dev] Re: Comparing dict.values()

2019-07-25 Thread Inada Naoki
ns on an items view does. -1. What is the motivation of this? In this case, I don't think "I found missing parts so I want to implement it for consistency" is not enough reason to implement it. I want a real-world application which requires it. Without a strong use case

[Python-Dev] Is "%zd" format is portable now?

2019-08-01 Thread Inada Naoki
nd-wprintf-functions?view=vs-2015 "%zd" is standard C99 feature. Can we assume it is portable for now? Regards, -- Inada Naoki ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org ht

[Python-Dev] Re: Is "%zd" format is portable now?

2019-08-01 Thread Inada Naoki
ted I wasted a few hours to read some PDFs and searching but I can not find any official document about snprintf(3). I feel it's impossible to support such platforms... Except AIX, I believe all platforms supports size_t and %zd because it's very basic C99 feature. Regards, -- Inada Naok

[Python-Dev] Re: Is "%zd" format is portable now?

2019-08-05 Thread Inada Naoki
Thank you for confining it! Currently, Python defines PY_FORMAT_SIZE_T as: #ifndef PY_FORMAT_SIZE_T # if SIZEOF_SIZE_T == SIZEOF_INT && !defined(__APPLE__) # define PY_FORMAT_SIZE_T "" # elif SIZEOF_SIZE_T == SIZEOF_LONG # define PY_FORMAT_SIZE_T "l" # elif defined(MS_WINDOWS) # define PY_FORMAT_

[Python-Dev] When to remove BytesWarning?

2020-10-23 Thread Inada Naoki
no-op. Bytes warning never emits. 3.12: Remove the -b option. BytesWarning will be deprecated in the document, but not to be removed. Users who want to use the -b option during 2->3 conversion need to use Python ~3.10 for a while. Regards, -- Inada Na

[Python-Dev] Re: When to remove BytesWarning?

2020-10-26 Thread Inada Naoki
s://github.com/python/cpython/blob/fb5db7ec58624cab0797b4050735be865d380823/Modules/_functoolsmodule.c#L802 https://github.com/python/cpython/blob/fb5db7ec58624cab0797b4050735be865d380823/Objects/codeobject.c#L724 (maybe more, but I'm not sure) Regards, -- Inada Naoki

[Python-Dev] Re: When to remove BytesWarning?

2020-10-26 Thread Inada Naoki
3.10: Stop emitting BytesWarning for bytes == unicode case, because this is the most annoying part. 3.11: Stop emitting BytesWarning in core and stdlib. 4.0: Remove `-b` option, `sys.flags.bytes_warning`, and `BytesWarning`. Regards, -- Inada Naoki ___ Pytho

[Python-Dev] Who is target reader of tutorial?

2020-11-05 Thread Inada Naoki
On the other hand, I want to remove confusion by removing mention to `__cause__`. Because I don't think `__context__` and `__cause__` is important for new users. See https://github.com/python/cpython/pull/23162 for my proposal. Regards, -- Inada Naoki _

[Python-Dev] Re: Please do not remove random bits of information from the tutorial

2020-11-07 Thread Inada Naoki
o beginners. And deleting `__cause__` is not solery for "didactic" reason, nor "loosing something precious." As written in the b.p.o. issue, mention only `__cause__` "lose some precious". We need to describe `__context__` and `__suppress_context__` too. But all of them

[Python-Dev] Re: Please do not remove random bits of information from the tutorial

2020-11-08 Thread Inada Naoki
t very often the documentation is very terse and the tutorial is the only > place > where some concepts are presented in a discursive way ... even if not > "beginner friendly". > You know, exception chaining is described well in other place so it was removed. I pr

[Python-Dev] Re: Please do not remove random bits of information from the tutorial

2020-11-08 Thread Inada Naoki
ibrary/exceptions.html#built-in-exceptions This is mentioned from the reviced tutorial, python-dev thread, and b.p.o issue. Regards, -- Inada Naoki ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@pyt

[Python-Dev] Re: When to remove BytesWarning?

2020-11-10 Thread Inada Naoki
s feature to lower > maintenance burden. Which warning helped you? str(bytes)? bytes == str? or bytes == int? I am not much concerned about removing str(bytes) warning anytime soon. Only bytes== warning is significant maintenance burden. Reg

[Python-Dev] Re: Ideas for improving the contribution experience

2020-11-25 Thread Inada Naoki
; in the issue title. * E.g. "needs compiler experts", "xml", "http", "mail", etc... It will help to find PRs I can help in my spare time. Regards, -- Inada Naoki ___ Python-Dev mailing list -- python-d

[Python-Dev] Re: Enhancement request for PyUnicode proxies

2020-12-27 Thread Inada Naoki
eprecate PyUnicode_READY() and make it no-op macro since Python 3.12. But I don't know how many third-parties use it properly, because legacy Unicode objects are very rare already. Regards, -- Inada Naoki ___ Python-Dev mailing list --

[Python-Dev] Re: Enhancement request for PyUnicode proxies

2020-12-28 Thread Inada Naoki
Unicode objects (including subclass) but any objects implementing some protocol. We already have __index__ for integers and buffer protocol for byts-like objects. That is examples of the policy. Regards, -- Inada Naoki ___ Python-Dev mailing list -- pytho

[Python-Dev] Re: Enhancement request for PyUnicode proxies

2020-12-28 Thread Inada Naoki
On Mon, Dec 28, 2020 at 10:53 PM Antoine Pitrou wrote: > > On Mon, 28 Dec 2020 11:07:46 +0900 > Inada Naoki wrote: > > > > Additionally, if we introduce the customizable lazy str object, it's > > very easy to release GIL during basic Unicode operations. M

[Python-Dev] Re: Enhancement request for PyUnicode proxies

2020-12-29 Thread Inada Naoki
If 3rd party wants to use completely different internal representation, it must not be a unicode object at all. Regards, -- Inada Naoki ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org

[Python-Dev] Re: PEP: Deferred Evaluation Of Annotations Using Descriptors

2021-01-11 Thread Inada Naoki
> Performance > --- > > Performance with this PEP should be favorable. In general, > resources are only consumed on demand—"you only pay for what you use". > Nice! > There are three scenarios to consider: > > * the runtime cost when annotations aren't defined, > * the runtime cost when a

[Python-Dev] Re: PEP: Deferred Evaluation Of Annotations Using Descriptors

2021-01-12 Thread Inada Naoki
On Wed, Jan 13, 2021 at 1:47 AM Larry Hastings wrote: > > On 1/11/21 5:33 PM, Inada Naoki wrote: > > Note that PEP 563 semantics allows more efficient implementation. > Annotation is just a single constant tuple, not a dict. > We already have the efficient implementation for Py

[Python-Dev] Re: PEP: Deferred Evaluation Of Annotations Using Descriptors

2021-01-16 Thread Inada Naoki
This PEP doesn't cover about what happened when __co_annotation__() failed (e.g. NameError). Forward reference is a major reason, but not a only reason for using string annotation. There are two other reasons: * Avoid importing heavy module. * Avoid circular imports. In these cases, this pattern

[Python-Dev] Re: PEP: Deferred Evaluation Of Annotations Using Descriptors

2021-01-18 Thread Inada Naoki
ce is not a problem here. Many type hinting use cases don't need type objects in runtime. So I think PEP 563 is better for type hinting user experience. Regards, -- Inada Naoki ___ Python-Dev mailing list -- python-dev@python.org To

[Python-Dev] Re: PEP: Deferred Evaluation Of Annotations Using Descriptors

2021-01-18 Thread Inada Naoki
On Tue, Jan 19, 2021 at 8:54 AM Larry Hastings wrote: > > On 1/18/21 3:42 PM, Inada Naoki wrote: > > Many type hinting use cases don't need type objects in runtime. > So I think PEP 563 is better for type hinting user experience. > > You mean, in situations where the u

[Python-Dev] Re: PEP 624: Remove Py_UNICODE encoder APIs

2021-01-21 Thread Inada Naoki
Hi, Lemburg. I want to send the PEP to SC. I think I wrote all your points in the PEP. Would you review it? Regards, On Tue, Aug 4, 2020 at 5:04 PM Inada Naoki wrote: > > On Tue, Aug 4, 2020 at 3:31 PM M.-A. Lemburg wrote: > > > > Hi Inada-san, > > > > thanks for

[Python-Dev] PEP 597: Add optional EncodingWarning

2021-01-31 Thread Inada Naoki
Hi, all. I updated the PEP 597 yesterday. Please review it to move it forward. PEP: https://www.python.org/dev/peps/pep-0597/ Previous thread: https://discuss.python.org/t/3880 Main difference from the previous version: * Added new warning category; EncodingWarning * Added dedicated option to e

[Python-Dev] Re: PEP 624: Remove Py_UNICODE encoder APIs

2021-02-01 Thread Inada Naoki
encoders? > That would keep extensions working after a recompile, since > Py_UNICODE is already a typedef to wchar_t. > That idea is written in the PEP already. https://www.python.org/dev/peps/pep-0624/#replace-py-unicode-with-wchar-t Regards, -- Inada Naoki

[Python-Dev] Re: PEP 624: Remove Py_UNICODE encoder APIs

2021-02-01 Thread Inada Naoki
become equal. So please don't think PEP 624 neglect only wchar_t*. Regards, -- Inada Naoki ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/

[Python-Dev] Re: PEP 597: Add optional EncodingWarning

2021-02-01 Thread Inada Naoki
On Tue, Feb 2, 2021 at 12:23 AM Victor Stinner wrote: > > Hi Inada-san, > > I followed the discussions on your different PEP and I like overall > your latest PEP :-) I have some minor remarks. > > On Mon, Feb 1, 2021 at 6:55 AM Inada Naoki wrote: > > The warning is di

[Python-Dev] Re: PEP 624: Remove Py_UNICODE encoder APIs

2021-02-02 Thread Inada Naoki
ucs4_utf8_encoder() can encode wchar_t* into UTF-8. But when wchar_t* is UTF-16, ucs2_utf8_encoder() can not handle surrogate escape. We need to use a temporary Unicode object. That is what "inefficient" means. I will update the section more elaborate. Regards, -- Inada Naoki _

[Python-Dev] Re: PEP 624: Remove Py_UNICODE encoder APIs

2021-02-02 Thread Inada Naoki
On Tue, Feb 2, 2021 at 9:40 PM Emily Bowman wrote: > > On Tue, Feb 2, 2021 at 3:47 AM Inada Naoki wrote: >> >> But when wchar_t* is UTF-16, ucs2_utf8_encoder() can not handle >> surrogate escape. >> We need to use a temporary Unicode object. That is what "ineff

[Python-Dev] Re: PEP 624: Remove Py_UNICODE encoder APIs

2021-02-04 Thread Inada Naoki
On Tue, Feb 2, 2021 at 8:40 PM Inada Naoki wrote: > > On Tue, Feb 2, 2021 at 7:37 PM M.-A. Lemburg wrote: > > > > BTW: I don't understand this comment: > > "They are inefficient on platforms wchar_t* is UTF-16. It is because > > built-in codecs sup

[Python-Dev] Re: PEP 597: Add optional EncodingWarning

2021-02-04 Thread Inada Naoki
gt; No. > > Hum. To write code compatible with Python 3.9, I understand that > encoding=None is the closest to encoding="locale". > > And I understand that encoding=getattr(io, "LOCALE_ENCODING", None) is > backward and forward compatible ;-) > &

[Python-Dev] Re: PEP 597: Add optional EncodingWarning

2021-02-06 Thread Inada Naoki
On Tue, Feb 2, 2021 at 1:40 PM Inada Naoki wrote: > > On Tue, Feb 2, 2021 at 12:23 AM Victor Stinner wrote: > > > > > > > Add ``io.LOCALE_ENCODING = "locale"`` constant too. This constant can > > > be used to avoid confusing ``LookupError: unknown e

[Python-Dev] Re: PEP 597: Add optional EncodingWarning

2021-02-06 Thread Inada Naoki
I send a pull request https://github.com/python/peps/pull/1799 * Add Backward/Forward Compatibility section * Add How to teach this section * Remove io.LOCALE_ENCODING constant -- Inada Naoki ___ Python-Dev mailing list -- python-dev@python.org To

[Python-Dev] Re: PEP 597: Add optional EncodingWarning

2021-02-09 Thread Inada Naoki
False)`? I think only we can do is documenting the option like this: """ EncodingWarning is warning to find missing encoding="utf-8" option. It is common pitfall that many Windows user Don't try to fix them if you need to use locale specific encoding. """

[Python-Dev] Re: PEP 597: Add optional EncodingWarning

2021-02-09 Thread Inada Naoki
; This warning is opt-in warning like BytesWarning. It will be a good tool to find potential problems for people knows what is the problem. But it is not recommended for users who don't understand what is the problem. -- Inada Naoki ___ Python-

[Python-Dev] Re: PEP 597: Add optional EncodingWarning

2021-02-09 Thread Inada Naoki
. I want to see how EncodingWarning and UTF-8 mode are adopted. I want to implement both EncodingWarning and per-site UTF-8 mode setting in Python 3.10. 5+ years later, we will see which approach is adopted by users. * If EncodingWarning is widely adopted by many developer

[Python-Dev] Re: PEP 597: Add optional EncodingWarning

2021-02-09 Thread Inada Naoki
On Wed, Feb 10, 2021 at 1:46 AM Anders Munch wrote: > > > Inada Naoki wrote: > > This warning is opt-in warning like BytesWarning. > > What use is a warning that no-one sees? At least, I see. We can fix stdlib and tests first, and fix some major tools too. After th

[Python-Dev] Re: PEP 597: Add optional EncodingWarning

2021-02-09 Thread Inada Naoki
On Wed, Feb 10, 2021 at 5:50 AM Paul Moore wrote: > > On Tue, 9 Feb 2021 at 16:54, Inada Naoki wrote: > > > > On Tue, Feb 9, 2021 at 9:31 PM Paul Moore wrote: > > > > > > Personally, I'm not at all keen on the idea of making users always > > >

[Python-Dev] Re: PEP 597: Add optional EncodingWarning

2021-02-10 Thread Inada Naoki
allation, venv, or conda env). But this is off topic. The thread for this topic is here. https://mail.python.org/archives/list/python-id...@python.org/thread/LQVK2UKPSOI2AHYFUWK6ZII2U6QKK6BP/ Regards, -- Inada Naoki ___ Python-Dev mailing list -- python-

[Python-Dev] Re: PEP 597: Add optional EncodingWarning

2021-02-10 Thread Inada Naoki
Don't touch -- You don't need to enable EncodingWarning. * encoding=locale.getpreferredencoding(False) -- Backward compatible. But doesn't work if you enabled UTF-8 mode. * encoding="mbcs" -- Backward compatible. Works even when you enabled UTF-8 mode. But it doesn't work

[Python-Dev] Re: PEP 597: Add optional EncodingWarning

2021-02-10 Thread Inada Naoki
On Wed, Feb 10, 2021 at 11:58 PM Anders Munch wrote: > > On Wed, Feb 10, 2021 at 1:46 AM Anders Munch wrote: > >> How about swapping around "locale" and None? > Inada Naoki wrote: > > > > I thought it, but it may not work. Consider about function like

[Python-Dev] Re: PEP 597: Add optional EncodingWarning

2021-02-11 Thread Inada Naoki
On Thu, Feb 11, 2021 at 4:44 PM Jim J. Jewett wrote: > > I just reread PEP 597, then re-reread the Rationale. > Do you read current PEP 597, or old PEP 597 in discuss.python.org? -- Inada Naoki ___ Python-Dev mailing list -- python-dev@p

[Python-Dev] Re: PEP 597: Add optional EncodingWarning

2021-02-11 Thread Inada Naoki
g) with open(filename, encoding=encoding) with f: return f.read() This function is not warned. Caller of this function is warned instead. It is difficult to implement in the Linter. -- Inada Naoki ___ Python-Dev mailing list -- p

[Python-Dev] Re: PEP 597: Add optional EncodingWarning

2021-02-11 Thread Inada Naoki
On Fri, Feb 12, 2021 at 5:18 AM Jim J. Jewett wrote: > > Inada Naoki wrote: > > > Default encoding is used for: > > > a. Really need to use locale specific encoding > > b. UTF-8 (bug. not work on Windows) > > c. ASCII (not a bug, but slow on Windows) >

[Python-Dev] Re: PEP 597: Add optional EncodingWarning

2021-02-11 Thread Inada Naoki
many places before the time. At least, we can fix all EncodingWarning in stdlib. Maybe, the "Prepare to change the default encoding to UTF-8" is misleading. I will try to fix the section or remove the section. -- Inada Naoki ___

[Python-Dev] Re: PEP 597: Add optional EncodingWarning

2021-02-11 Thread Inada Naoki
On Fri, Feb 12, 2021 at 12:28 PM Jim J. Jewett wrote: > > (I apologize if my summaries distort what Inada Naoki > explained.) > > He said that some people use the default None when they really want > either UTF-8 or ASCII. Yes. Even Python core developers. For example: https

[Python-Dev] Re: PEP 597: Add optional EncodingWarning

2021-02-11 Thread Inada Naoki
On Fri, Feb 12, 2021 at 12:45 PM Jim J. Jewett wrote: > > On Thu, Feb 11, 2021 at 7:35 PM Inada Naoki wrote: > > > The PEP helps developers living on UTF-8 locale to find missing > > `encoding="utf-8"` bug. > > This type of bug is very common, and many Wind

[Python-Dev] Re: PEP 597: Add optional EncodingWarning

2021-02-12 Thread Inada Naoki
ew > environment variable, and maybe a new launch flag ... these all seem to risk > just making things more complicated without sufficient gain. > > Would a recipe for site-packages be sufficient, or does this need to run too > early in the bootstrapping process? >

[Python-Dev] Re: PEP 597: Add optional EncodingWarning

2021-02-13 Thread Inada Naoki
c and will find many possible bugs that happen only on Windows, even if they don't use Windows daily development. Isn't this option worth enough? -- Inada Naoki ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an emai

[Python-Dev] Re: PEP: Deferred Evaluation Of Annotations Using Descriptors

2021-02-14 Thread Inada Naoki
ferences used only type hints, or user can not get even string form annotation which is very useful for REPLs. -- Inada Naoki ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.

[Python-Dev] PEP 597 bikeshedding: envvar / option name.

2021-02-14 Thread Inada Naoki
Regards, -- Inada Naoki ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list

[Python-Dev] Re: PEP 597 bikeshedding: envvar / option name.

2021-02-19 Thread Inada Naoki
do you think? about PYTHON_WARN_DEFAULT_ENCODING? --- Inada Naoki ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archiv

[Python-Dev] Re: PEP 597 bikeshedding: envvar / option name.

2021-02-21 Thread Inada Naoki
Thank you for all. I finally submit the PEP 597 with PYTHONWARNDEFAULTENCODING / warn_default_encoding. On Mon, Feb 15, 2021 at 2:28 PM Inada Naoki wrote: > > I am updating PEP 597 to include discussions in the thread. > Before finishing the PEP, I need to decide the option name. &

[Python-Dev] Re: Steering Council update for February

2021-03-09 Thread Inada Naoki
/1272280760280637441 > > Anyway, this is yet another SJW non-issue (countries other than US don't have > a modern history of slavery) so this change is a political > statement rather than has any technical merit. > Yes. If we don't change the name, we need to pay our energy to sa

[Python-Dev] Re: [python-committers] Re: Accepting PEP 597 (Add optional EncodingWarning)

2021-03-15 Thread Inada Naoki
thon 3.9 support and use `encoding="locale"` where locale encoding is needed. Regards, -- Inada Naoki ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/li

[Python-Dev] Re: Accepting PEP 624 (Remove Py_UNICODE encoder APIs)

2021-03-15 Thread Inada Naoki
on Steering Council's gratitude, > Thomas. > -- > Thomas Wouters > > Hi! I'm an email virus! Think twice before sending your email to help me > spread! -- Inada Naoki ___ Python-Dev mailing list -- python-dev@python.o

[Python-Dev] pth file encoding

2021-03-15 Thread Inada Naoki
. For paths, fsencoding is the right encoding. It is UTF-8 on Windows (excpet PYTHONLEGACYWINDOWSFSENCODING is set), and locale-specific encoding in Linux. What encoding should we use? * UTF-8 * sys.getfilesystemencoding() * Keep status-quo. Regards, -- Inada Naoki

[Python-Dev] Re: pth file encoding

2021-03-16 Thread Inada Naoki
OK. setuptools doesn't specify encoding at all. So locale-specific encoding is used. We can not fix it in short term. On Wed, Mar 17, 2021 at 4:56 AM Brett Cannon wrote: > > > > On Mon, Mar 15, 2021 at 7:53 PM Inada Naoki wrote: >> >> Hi, all. >> >> I

[Python-Dev] Re: pth file encoding

2021-03-17 Thread Inada Naoki
On Wed, Mar 17, 2021 at 5:33 PM Paul Moore wrote: > > On Wed, 17 Mar 2021 at 08:13, Michał Górny wrote: > > > > On Wed, 2021-03-17 at 13:55 +0900, Inada Naoki wrote: > > > OK. setuptools doesn't specify encoding at all. So locale-specific > > > encoding

[Python-Dev] Re: Weird io.OpenWrapper hack to use a function as method

2021-03-31 Thread Inada Naoki
h. > ___ > Python-Dev mailing list -- python-dev@python.org > To unsubscribe send an email to python-dev-le...@python.org > https://mail.python.org/mailman3/lists/python-dev.python.org/ > Message archived at > https://mail.python.org/archives/

[Python-Dev] Re: Weird io.OpenWrapper hack to use a function as method

2021-04-01 Thread Inada Naoki
On Thu, Apr 1, 2021 at 11:52 AM Brett Cannon wrote: > > On Wed., Mar. 31, 2021, 18:56 Inada Naoki, wrote: >> >> Do we need _pyio at all? >> Does PyPy or any other Python implementation use it? > > https://www.python.org/dev/peps/pep-0399/ would suggest rolling back

[Python-Dev] When we remove 'U' mode of open()?

2021-04-07 Thread Inada Naoki
'U' mode was removed once and resurrected. https://bugs.python.org/issue39674 As far as I can see, it is postponed to Python 3.10. Am I right? Can we remove 'U' mode in Python 3.10? Regards, -- Inada Naoki ___ Python-Dev mailin

[Python-Dev] Re: When we remove 'U' mode of open()?

2021-04-07 Thread Inada Naoki
On Wed, Apr 7, 2021 at 11:29 PM Miro Hrončok wrote: > > On 07. 04. 21 14:53, Inada Naoki wrote: > > 'U' mode was removed once and resurrected. > > https://bugs.python.org/issue39674 > > > > As far as I can see, it is postponed to Python 3.10. Am I right? &

[Python-Dev] Re: When we remove 'U' mode of open()?

2021-04-07 Thread Inada Naoki
on-dev-le...@python.org > https://mail.python.org/mailman3/lists/python-dev.python.org/ > Message archived at > https://mail.python.org/archives/list/python-dev@python.org/message/VTROKN5UOU3EN6F3OLX5RUK7TVETAXKB/ > Code of Conduct: http://python.org/psf/codeofconduct/ -- Inada Nao

[Python-Dev] Re: When we remove 'U' mode of open()?

2021-04-07 Thread Inada Naoki
On Thu, Apr 8, 2021 at 9:54 AM Inada Naoki wrote: > > We are close to 3.10 beta and it is not ideal timing for removing. > So my proposal is: > > * Remove 'U' in fileinput, because it makes my task little simpler. > * Remove 'U' in other places in Python 3.1

[Python-Dev] Re: PEP 649: Deferred Evaluation Of Annotations Using Descriptors, round 2

2021-04-12 Thread Inada Naoki
at > https://mail.python.org/archives/list/python-dev@python.org/message/QSASX6PZ3LIIFIANHQQFS752BJYFUFPY/ > Code of Conduct: http://python.org/psf/codeofconduct/ -- Inada Naoki ___ Python-Dev mailing list -- python-dev@python.org To unsub

[Python-Dev] Re: PEP 649: Deferred Evaluation Of Annotations Using Descriptors, round 2

2021-04-12 Thread Inada Naoki
On Tue, Apr 13, 2021 at 8:58 AM Larry Hastings wrote: > > On 4/12/21 4:50 PM, Inada Naoki wrote: > > As PEP 597 says, eval() is slow. But it can avoidable in many cases > with PEP 563 semantics. > > PEP 597 is "Add optional EncodingWarning". You said PEP 597 in o

[Python-Dev] Re: PEP 649: Deferred Evaluation Of Annotations Using Descriptors, round 2

2021-04-12 Thread Inada Naoki
On Tue, Apr 13, 2021 at 9:57 AM Larry Hastings wrote: > > > On 4/12/21 4:50 PM, Inada Naoki wrote: > > PEP 563 solves all problems relating to types not accessible in runtime. > There are many reasons users can not get types used in annotations at runtime: > > * To avoid c

[Python-Dev] Re: PEP 649: Deferred Evaluation Of Annotations Using Descriptors, round 2

2021-04-12 Thread Inada Naoki
On Tue, Apr 13, 2021 at 11:18 AM Paul Bryan wrote: > > On Tue, 2021-04-13 at 10:47 +0900, Inada Naoki wrote: > > On Tue, Apr 13, 2021 at 9:57 AM Larry Hastings wrote: > > > This is really the heart of the debate over PEP 649 vs PEP 563. If you > examine an annotati

[Python-Dev] Making staticmethod callable, any oposite?

2021-04-13 Thread Inada Naoki
than OpenWrapper and DocDescripter. Additionally, if we have same issue in other module, we can just use staticmethod, instead of copy&paste OpenWrapper and DocDescripter. So it provides "compensating practical benefit". Regards, -- Inada Naoki __

[Python-Dev] Re: PEP 649: Deferred Evaluation Of Annotations Using Descriptors, round 2

2021-04-13 Thread Inada Naoki
se use case used only is a limited part of application. On the other hand, type hint can be used almost everywhere in application code base. It must cheap enough. Regards, -- Inada Naoki ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe

[Python-Dev] Re: PEP 649: Deferred Evaluation Of Annotations Using Descriptors, round 2

2021-04-14 Thread Inada Naoki
/cpython/pull/23056 too. -- Inada Naoki ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https

[Python-Dev] Re: PEP 649: Deferred Evaluation Of Annotations Using Descriptors, round 2

2021-04-14 Thread Inada Naoki
+/- 0.00016614519056599577 exec: avg: 0.09546191191766411 +/- 0.00018099485135812695 ``` Summary: * Both of PEP 563 and PEP 649 has low memory consumption than Python 3.9. * Importing time (unmarshal+exec) is about 0.7sec on old semantics and PEP 649, 0.43sec on PEP 563. On Thu, Apr 15, 2021 at 10:31 AM Inada Naoki

[Python-Dev] Re: PEP 649: Deferred Evaluation Of Annotations Using Descriptors, round 2

2021-04-14 Thread Inada Naoki
TYPE_CHECKING` and manually stringified annotation is used in real world applications. I want to mix both use cases. -- Inada Naoki ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https:/

[Python-Dev] Re: PEP 649: Deferred Evaluation Of Annotations Using Descriptors, round 2

2021-04-15 Thread Inada Naoki
from eval(). If we implement a "lazy load" mechanizm for docstrings and annotations, overhead will become cheaper. * pyc file become bigger (but who cares?) I will read PEP 649 implementation to find missing optimizations other than GH-25419 and GH-230

[Python-Dev] Re: In support of PEP 649

2021-04-15 Thread Inada Naoki
se type hinting even after I dropped Python 3.9 support. But it is up to release manager and steering council. -- Inada Naoki ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.p

[Python-Dev] Re: PEP 649: Deferred Evaluation Of Annotations Using Descriptors, round 2

2021-04-15 Thread Inada Naoki
. Unlike simple function case, PEP 649 creates function object instead of code object for __co_annotation__ of methods. It cause this overhead. Can we avoid creating functions for each annotation? -- Inada Naoki ___ Python-Dev mailing list -- python-dev@py

[Python-Dev] Re: In support of PEP 649

2021-04-16 Thread Inada Naoki
ter PEP 563, only `'List[int]'` is practical so we can stop supporting `List["int"]` and others at some point. So playing with runtime type will become easier in the future. Am I wrong? -- Inada Naoki ___ Python-Dev mailing list -- p

[Python-Dev] Re: PEP 563 in light of PEP 649

2021-04-16 Thread Inada Naoki
/compile.c:1977 #13 0x55688e51 in compiler_class (c=c@entry=0x7fffc3d0, s=s@entry=0x56222a60) at Python/compile.c:2623 #14 0x55687ce3 in compiler_visit_stmt (s=, c=0x7fffc3d0) at Python/compile.c:3667 #15 compiler_body (c=c@entry=0x7fffc3d0, stmts=0x

[Python-Dev] Re: In support of PEP 649

2021-04-18 Thread Inada Naoki
As far as I know, both Pydantic and marshmallow start using annotation for runtime type after PEP 563 is accepted. Am I right? When PEP 563 is accepted, there are some tools using runtime type in annotation, but they are not adopted widely yet. But we didn't have any good way to emit DeprecationWa

[Python-Dev] Re: PEP 563 in light of PEP 649

2021-04-20 Thread Inada Naoki
__ > Python-Dev mailing list -- python-dev@python.org > To unsubscribe send an email to python-dev-le...@python.org > https://mail.python.org/mailman3/lists/python-dev.python.org/ > Message archived at > https://mail.python.org/archives/list/python-dev@python.org/message/ZAPCP4MFDO

[Python-Dev] Re: PEP 563 in light of PEP 649

2021-04-20 Thread Inada Naoki
On Tue, Apr 20, 2021 at 4:24 PM Inada Naoki wrote: > > Just an idea: do not save co_name and co_firstlineno in code object > for function annotations. > When creating a function object from a code object, they can be copied > from annotated function. > I created a pu

[Python-Dev] Re: PEP 563 in light of PEP 649

2021-04-20 Thread Inada Naoki
`` # co_annotations $ ./python ~/ann_test.py 3 code size: 236106 bytes memory: 208261 bytes unmarshal: avg: 653.788ms +/-1.257ms exec: avg: 95.783ms +/-0.169ms # optimize $ ./python ~/ann_test.py 3 code size: 162097 bytes memory: 208261 bytes unmarshal: avg: 458.959ms +/-0.163ms exec: avg: 98.327ms +

[Python-Dev] Re: Keeping Python a Duck Typed Language.

2021-04-22 Thread Inada Naoki
(c) is broken by design. It is not fixable. IMHO, We should chose (a) or (b) and reject any idea relying on Sequence ABC. Regards, -- Inada Naoki ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@p

[Python-Dev] Re: Can't sync cpython main to my fork

2021-05-06 Thread Inada Naoki
@python.org > https://mail.python.org/mailman3/lists/python-dev.python.org/ > Message archived at > https://mail.python.org/archives/list/python-dev@python.org/message/J6GGEKUBMPU3X3WNKUG2XUD3GDV7L2FK/ > Code of Conduct: http://python.org/psf/codeofconduct/ -- Inada Naoki

<    1   2   3   4   5   6   >