[issue47053] Reduce de-optimization in BINARY_OP_INPLACE_ADD_UNICODE

2022-03-25 Thread Mark Shannon
Mark Shannon added the comment: New changeset cca43b7d64f47ea921d0f7a347ae1a839c5463c3 by Dennis Sweeney in branch 'main': bpo-47053: Reduce deoptimization in BINARY_OP_INPLACE_ADD_UNICODE (GH-31318) https://github.com/python/cpython/commit/cca43b7d64f47ea921d0f7a347ae1a

[issue47164] [C API] Add private "CAST" macros to clean up casts in C code

2022-03-30 Thread Mark Shannon
Mark Shannon added the comment: I think that adding macros makes readability worse. The macro is only more readable if you already know what it does. If you don't, then you need to look up the macro, and understand the cast in the macro (which is harder than understanding the original

[issue47164] [C API] Add private "CAST" macros to clean up casts in C code

2022-03-30 Thread Mark Shannon
Mark Shannon added the comment: The problem in the example you give is the need for the cast in the first place. If `func` were a `PyCFunctionObject *` instead of a `PyObject *`, then there would be no cast. Making the casts explicit serves as a reminder that a type check is needed

[issue47120] Make all jump opcodes relative

2022-03-31 Thread Mark Shannon
Mark Shannon added the comment: New changeset a00518d9ad9a8f408a9699191019d75dd8406c32 by Irit Katriel in branch 'main': bpo-47120: Replace the JUMP_ABSOLUTE opcode by the relative JUMP_BACKWARD (GH-32115) https://github.com/python/cpython/commit/a00518d9ad9a8f408a9699191019d7

[issue40421] [C API] Add public getter functions for the internal PyFrameObject structure

2022-03-31 Thread Mark Shannon
Mark Shannon added the comment: New changeset 74b95d86e0f14603f878c4df3133bc8a93f8f80a by Mark Shannon in branch 'main': bpo-40421: Add missing getters for frame object attributes to C-API. (GH-32114) https://github.com/python/cpython/commit/74b95d86e0f14603f878c4df3133bc

[issue44159] mimetypes - "strict" on Windows

2022-03-31 Thread Mark Dong
Mark Dong added the comment: Hi, I want to follow up on this: On Linux (Ubuntu 20.04.4 LTS), the module also loads everything it finds in the registries (a.k.a, entries in the "knownfiles" variable) in "strict" mode, even though some of them aren't registered in

[issue47009] Streamline list.append for the common case

2022-04-01 Thread Mark Shannon
Mark Shannon added the comment: New changeset a0ea7a116ce52a178c02d42b684089758bd7f355 by Dennis Sweeney in branch 'main': bpo-47009: Streamline list.append for the common case (GH-31864) https://github.com/python/cpython/commit/a0ea7a116ce52a178c02d42b684089758bd7f355 -

[issue46841] Inline bytecode caches

2022-04-01 Thread Mark Shannon
Mark Shannon added the comment: New changeset bd2e47c8830d1b2869f2b4345945a5e0c3b4e3fb by Brandt Bucher in branch 'main': bpo-46841: Avoid unnecessary allocations in code object comparisons (GH-3) https://github.com/python/cpython/commit/bd2e47c8830d1b2869f2b4345945a5

[issue46841] Inline bytecode caches

2022-04-01 Thread Mark Shannon
Mark Shannon added the comment: New changeset ae9de82e321581e1906c6ef2a7ad83ab30ae3325 by Brandt Bucher in branch 'main': bpo-46841: Use a `bytes` object for `_co_code_adaptive` (GH-32205) https://github.com/python/cpython/commit/ae9de82e321581e1906c6ef2a7ad83

[issue47186] split JUMP_IF_NOT_EXC/EG_MATCH into CHECK_EXC/EG_MATCH + jump

2022-04-01 Thread Mark Shannon
Mark Shannon added the comment: New changeset 04e07c258f4f2ac85e25355242a113f98a706f04 by Irit Katriel in branch 'main': bpo-47186: Replace JUMP_IF_NOT_EXC_MATCH by CHECK_EXC_MATCH + jump (GH-32231) https://github.com/python/cpython/commit/04e07c258f4f2ac85e25355242a113

[issue47172] Make virtual opcodes in the compiler negative and is_jump() identify only proper jumps

2022-04-01 Thread Mark Shannon
Mark Shannon added the comment: New changeset 997ba5d126f5040d5b7536f73bc89049e9f9421d by Irit Katriel in branch 'main': bpo-47172: Compiler enhancements (GH-32200) https://github.com/python/cpython/commit/997ba5d126f5040d5b7536f73bc89049e9f9421d -- nosy: +Ma

[issue44800] Code readability: rename InterpreterFrame to `_Py_framedata`

2022-04-04 Thread Mark Shannon
Change by Mark Shannon : -- pull_requests: +30363 pull_request: https://github.com/python/cpython/pull/32301 ___ Python tracker <https://bugs.python.org/issue44

[issue47215] Add "unstable" frame stack api

2022-04-04 Thread Mark Shannon
New submission from Mark Shannon : We need to provide an API to create, swap and free frame stacks for greenlets. Since this is primarily for greenlets (and any other stackful coroutines libraries that want to use it) it will be "unstable". In this case, by "unstable" I

[issue47215] Add "unstable" frame stack api

2022-04-04 Thread Mark Shannon
Change by Mark Shannon : -- keywords: +patch pull_requests: +30366 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/32303 ___ Python tracker <https://bugs.python.org/issu

[issue44800] Code readability: rename InterpreterFrame to `_Py_framedata`

2022-04-04 Thread Mark Shannon
Mark Shannon added the comment: New changeset 8a349eb30b54bab9a7146fc10e3379c3cacaa19e by Mark Shannon in branch 'main': Revert "bpo-44800: Document internal frame naming conventions (GH-32281)" (#32301) https://github.com/python/cpython/commit/8a349eb30b54bab9a714

[issue45317] Document the removal the usage of the C stack in Python to Python calls

2022-04-04 Thread Mark Shannon
Change by Mark Shannon : -- keywords: +patch pull_requests: +30367 stage: -> patch review pull_request: https://github.com/python/cpython/pull/32304 ___ Python tracker <https://bugs.python.org/issu

[issue47009] Streamline list.append for the common case

2022-04-05 Thread Mark Shannon
Mark Shannon added the comment: New changeset 6c6e0408a663c1f53dad403f54a18d444da39cb7 by Dennis Sweeney in branch 'main': bpo-47009: Let PRECALL_NO_KW_LIST_APPEND do its own POP_TOP (GH-32239) https://github.com/python/cpython/commit/6c6e0408a663c1f53dad403f54a18d

[issue28540] math.degrees(sys.float_info.max) should throw an OverflowError exception

2022-04-05 Thread Mark Dickinson
Mark Dickinson added the comment: FWIW, I do consider this a bug, albeit a minor one. I may find time to fix it at some point (but it's fine to leave it closed until that time comes). -- ___ Python tracker <https://bugs.python.org/is

[issue47248] Possible slowdown of regex searching in 3.11

2022-04-07 Thread Mark Shannon
New submission from Mark Shannon : The 3 regular expression benchmarks in the pyperformance suite, regex_v8, regex_effbot and regex_dna show slowdowns between 3% and 10%. Looking at the stats, nothing seems wrong with specialization or the memory optimizations. Which strongly suggests a

[issue47257] add methods to get first and last elements of a range

2022-04-08 Thread Mark Dickinson
Mark Dickinson added the comment: > but it's messy and potentially tricky to get the actual first and last values > of the range Doesn't simple indexing already provide what you need here? >>> range(1, 5, 2)[0] # first element of range 1 >>> range(1, 5,

[issue40421] [C API] Add public getter functions for the internal PyFrameObject structure

2022-04-08 Thread Mark Shannon
Change by Mark Shannon : -- pull_requests: +30439 pull_request: https://github.com/python/cpython/pull/32413 ___ Python tracker <https://bugs.python.org/issue40

[issue47046] Add `f_state` attribute to FrameObjects.

2022-04-08 Thread Mark Shannon
Mark Shannon added the comment: Don't you need to know if a "call" event is a call or the resumption of a generator? -- ___ Python tracker <https://bugs.pyt

[issue37831] bool(~True) == True

2019-08-14 Thread Mark Dickinson
Mark Dickinson added the comment: [Raymond] > Given that & | and ^ are closed under bools [...] So maybe the right fix is to change that fact? I'm not sure what the value of having True & True return True rather than 1 is, beyond misleading people into thinking that bitwise

[issue37831] bool(~True) == True

2019-08-14 Thread Mark Dickinson
Mark Dickinson added the comment: > Because bool is embedded in int, it's okay to return a bool value *that > compares equal to the int from the corresponding int operation*. Agreed that it's okay, but I'd like to understand why it's considered *desirable*. W

[issue29535] datetime hash is deterministic in some cases

2019-08-15 Thread Mark Dickinson
Mark Dickinson added the comment: > shouldn't numerics, datetime objects, and tuples be non-deterministically > hashed as well? [...] Making the numeric hash non-predictable while maintaining its current properties would be difficult. But fortunately, I don't think it&#

[issue37863] Speed up hash(fractions.Fraction)

2019-08-15 Thread Mark Dickinson
Mark Dickinson added the comment: > Should be significantly faster. If not, the new "-1" implementation should > be changed ;-) I wouldn't have bet on this, before seeing Raymond's benchmark results. Writing a fast path for invmod for C-size integers is still on m

[issue37863] Speed up hash(fractions.Fraction)

2019-08-15 Thread Mark Dickinson
Mark Dickinson added the comment: > That's a major difference between exponents of bit lengths 61 > ((P-2).bit_length()) and 1 ((1).bit_length()). Right, but that's stacked up against the cost of the extended Euclidean algorithm for computing the inverse. The extended gcd f

[issue37863] Speed up hash(fractions.Fraction)

2019-08-15 Thread Mark Dickinson
Mark Dickinson added the comment: > Indeed, I bet it would pay in `long_pow()` to add another test, under the `if > (Py_SIZE(b) < 0)` branch, to skip the exponentiation part entirely when b is > -1. Agreed. -- ___ Python tra

[issue29535] datetime hash is deterministic in some cases

2019-08-16 Thread Mark Dickinson
Mark Dickinson added the comment: > Why so? Python's hash needs to obey the invariant that `hash(x) == hash(y)` for any two hashable objects with `x == y`. That makes life particularly hard for numeric types, because there are a number of *different* numeric types where equality

[issue37884] Optimize Fraction() and statistics.mean()

2019-08-20 Thread Mark Dickinson
Mark Dickinson added the comment: > This issue if for optimization only. It does not expand the math module API. I think it does, though. The PR adds something to the math module that's tested, that needs to be maintained for other modules to work, and that's imported for u

[issue37893] pow() should disallow inverse when modulus is +-1

2019-08-20 Thread Mark Dickinson
Mark Dickinson added the comment: > While I doubt this, he may even argue that it's working correctly already ;-) Yes, I'd argue exactly that. There's nothing ill-defined about working modulo +/-1. Z/1Z is a perfectly-well-defined ring. What's the moti

[issue37893] pow() should disallow inverse when modulus is +-1

2019-08-20 Thread Mark Dickinson
Mark Dickinson added the comment: > Z/1Z is a perfectly-well-defined ring. More to the point, it's a perfectly well-defined ring in which every element is invertible. That's why the Euler phi function has phi(1) = 1 (rather than phi(1) = 0)

[issue37893] pow() should disallow inverse when modulus is +-1

2019-08-20 Thread Mark Dickinson
Mark Dickinson added the comment: > I guess I'm just not used to 0 being a multiplicative identity. Yes, there's a whole generation of mathematicians who believe (wrongly) that "0 != 1" is one of the ring axioms. But it turns out that excluding the zero rin

[issue37905] Remove NormalDist.overlap() or improve documentation?

2019-08-21 Thread Mark Dickinson
Change by Mark Dickinson : -- nosy: +mark.dickinson ___ Python tracker <https://bugs.python.org/issue37905> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue37919] nntplib throws spurious NNTPProtocolError

2019-08-22 Thread Mark Sapiro
New submission from Mark Sapiro : This is really due to an nntp server bug, but here's the scenerio. A connection is opened to the server. An article is posted via the connection's post() method. The server responds to the article data with 240 Article posted but due to the serv

[issue37938] refactor PyLong_As*() functions

2019-08-25 Thread Mark Dickinson
Change by Mark Dickinson : -- nosy: +mark.dickinson ___ Python tracker <https://bugs.python.org/issue37938> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue37946] Add the Bessel functions of the first and second kind to the math module

2019-08-25 Thread Mark Dickinson
Mark Dickinson added the comment: They're not part of the C standard and they're not provided by all C libraries; we'd have to code our own and add thorough tests for the implementations (as we have for lgamma, gamma, erf, and other functions that may or may not exist in th

[issue37946] Add the Bessel functions of the first and second kind to the math module

2019-08-26 Thread Mark Dickinson
Mark Dickinson added the comment: I'd also say that SciPy does this much better than the Python math library could ever hope to (without that math library effectively becoming a copy of scipy.special). It probably wouldn't be long before a user of the new Bessel functions also wan

[issue37946] Add the Bessel functions of the first and second kind to the math module

2019-08-26 Thread Mark Dickinson
Change by Mark Dickinson : -- nosy: +tim.peters ___ Python tracker <https://bugs.python.org/issue37946> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue37946] Add the Bessel functions of the first and second kind to the math module

2019-08-26 Thread Mark Dickinson
Mark Dickinson added the comment: Tim, Raymond: thoughts? I'm inclined to close this as rejected. -- ___ Python tracker <https://bugs.python.org/is

[issue37968] The turtle

2019-08-28 Thread Mark Dickinson
Mark Dickinson added the comment: > 1 the next code SHOULD produce an error message. Think that it's followed > by a few dozens of code lines: > from turtle import * > fd; rt(90) There's no reasonable mechanism in current Python by which this could produce an error mess

[issue37968] Add a turtle module function to draw a circle centered at the turtle

2019-08-28 Thread Mark Dickinson
Mark Dickinson added the comment: Updated title, type and Python version (this would be a new feature, so would be targeted at Python 3.9). -- components: +Library (Lib) title: The turtle -> Add a turtle module function to draw a circle centered at the turtle type: -> enhan

[issue37968] Add a turtle module function to draw a circle centered at the turtle

2019-08-28 Thread Mark Dickinson
Change by Mark Dickinson : -- nosy: +glingl, willingc -mark.dickinson ___ Python tracker <https://bugs.python.org/issue37968> ___ ___ Python-bugs-list mailin

[issue37973] improve docstrings of sys.float_info

2019-08-29 Thread Mark Dickinson
Mark Dickinson added the comment: Unhelpful indeed. +1 to updating those docstrings to match the details at docs.python.org. -- nosy: +mark.dickinson ___ Python tracker <https://bugs.python.org/issue37

[issue37973] improve docstrings of sys.float_info

2019-08-29 Thread Mark Dickinson
Mark Dickinson added the comment: @nanjekyejoannah I'm not seeing how that issue is related to this one (except that they're both about docstrings). Can you elaborate? -- ___ Python tracker <https://bugs.python.o

[issue37980] regression when passing numpy bools to sorted(..., reverse=r)

2019-08-29 Thread Mark Dickinson
Mark Dickinson added the comment: Closely related: #37427. I'm not sure why that issue was closed. My naive expectation would be that in most cases where an API specifies a flag, an arbitrary Python object can be used for that flag (and is then interpreted in boolean context). That&

[issue37427] sorted, list.sort reject non-boolean objects with __bool__() as `reverse` parameter

2019-08-29 Thread Mark Dickinson
Mark Dickinson added the comment: See also #37980. I'd support a change to have the `reversed` argument to `sort` and `sorted` be automatically interpreted in boolean context. -- ___ Python tracker <https://bugs.python.org/is

[issue37980] regression when passing numpy bools to sorted(..., reverse=r)

2019-08-30 Thread Mark Dickinson
Mark Dickinson added the comment: Yes, I think there's a lot of history here that obscures the picture. We have mechanisms in Python to allow 3rd party objects to be interpreted as floats (via __float__) or as integers (via __index__). So np.int64 (for example) doesn't subcla

[issue37980] regression when passing numpy bools to sorted(..., reverse=r)

2019-08-30 Thread Mark Dickinson
Mark Dickinson added the comment: Since this particular issue is about "sort", I'm adding Tim and Raymond to the nosy list. -- nosy: +rhettinger, tim.peters ___ Python tracker <https://bugs.pyt

[issue37980] regression when passing numpy bools to sorted(..., reverse=r)

2019-08-30 Thread Mark Dickinson
Mark Dickinson added the comment: Victor > The purpose of the DeprecationWarning is to give time to numpy developers to > update the bool_() type, before it becomes an error. No, that's not what's happening: currently, np.bool_ *does* support __index__. In the future, it

[issue38005] Coercing strings and non-integer numbers to interpreter ID

2019-09-02 Thread Mark Dickinson
Mark Dickinson added the comment: Urk! Having `10 == id == 10.1` should imply `10 == 10.1`, by transitivity. Are interpreter.InterpreterID objects hashable? If so, we've got a violation of the rule that `x == y` implies `hash(x) == hash(y)`. -- nosy: +mark.dick

[issue38027] Can't use Numpy, SciPy, pandas in Python3.8.0b4 without conda

2019-09-04 Thread Mark Dickinson
Mark Dickinson added the comment: There are known Cython-related issues with the latest NumPy *release* and Python 3.8, due to a signature change in PyCode_New. But those issues are already fixed in NumPy master. `pip install numpy` fails for me in a Python 3.8b4 venv, but `pip install git

[issue38027] Can't use Numpy, SciPy, pandas in Python3.8.0b4 without conda

2019-09-04 Thread Mark Dickinson
Mark Dickinson added the comment: I forgot to include the NumPy issue link: https://github.com/numpy/numpy/issues/14403 (and other similar issues). The pip error output you posted looks like the same issue to me. -- ___ Python tracker <ht

[issue38062] Clarify that atexit.unregister matches by equality, not identity

2019-09-09 Thread Mark Dickinson
New submission from Mark Dickinson : Suppose I have a class that looks like this: class A: def cleanup(self): print("Doing essential cleanup") and on an instance `a = A()`, I do: `atexit.register(a.cleanup)`. Then it's not obvious from the docume

[issue38062] Clarify that atexit.unregister matches by equality, not identity

2019-09-09 Thread Mark Dickinson
Change by Mark Dickinson : -- assignee: -> docs@python components: +Documentation nosy: +docs@python versions: +Python 3.7, Python 3.8 ___ Python tracker <https://bugs.python.org/issu

[issue21120] PyArena type is used in headers from the limited API

2019-09-09 Thread Mark Shannon
Mark Shannon added the comment: This seems like the correct thing to do. Since the AST changes from version to version, I don't see how these files could reasonably be part of the limited API. -- nosy: +Mark.Shannon ___ Python tracker &

[issue21120] PyArena type is used in headers from the limited API

2019-09-12 Thread Mark Shannon
Mark Shannon added the comment: New changeset 421a72af4deaec96a49a79951b9c2546a2faa13d by Mark Shannon (Zackery Spytz) in branch 'master': bpo-21120: Exclude Python-ast.h, ast.h and asdl.h from the limited API (#14634) https://github.com/python/cpyt

[issue21120] PyArena type is used in headers from the limited API

2019-09-12 Thread Mark Shannon
Change by Mark Shannon : -- stage: patch review -> resolved ___ Python tracker <https://bugs.python.org/issue21120> ___ ___ Python-bugs-list mailing list Un

[issue21120] PyArena type is used in headers from the limited API

2019-09-12 Thread Mark Shannon
Change by Mark Shannon : -- status: open -> closed ___ Python tracker <https://bugs.python.org/issue21120> ___ ___ Python-bugs-list mailing list Unsubscrib

[issue38135] Depth first search in compile.c creates wrong BB order for certain CFG.

2019-09-12 Thread Mark Shannon
New submission from Mark Shannon : Consider a flow graph of four nodes, A, B, C, D where the A, B, C are "next" successors of each other (in order) and C branches to B and B branches to D. Note that there is no "next" link to the D block. The correct order is A, B, C, D bu

[issue38135] Depth first search in compile.c creates wrong BB order for certain CFG.

2019-09-12 Thread Mark Shannon
Change by Mark Shannon : -- nosy: +pablogsal ___ Python tracker <https://bugs.python.org/issue38135> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue38135] Depth first search in compile.c creates wrong BB order for certain CFG.

2019-09-12 Thread Mark Shannon
Change by Mark Shannon : -- keywords: +patch pull_requests: +15664 stage: -> patch review pull_request: https://github.com/python/cpython/pull/16042 ___ Python tracker <https://bugs.python.org/issu

[issue29988] with statements are not ensuring that __exit__ is called if __enter__ succeeds

2019-09-12 Thread Mark Shannon
Mark Shannon added the comment: I expect to fix this is as part of the general improvements I am making to the bytecode, interpreter and compiler. So it should be fixed for 3.9 but not for 3.8 -- ___ Python tracker <https://bugs.python.

[issue26360] Deadlock in thread.join on Python 2.7/Mac OS X 10.9, 10.10

2019-09-14 Thread Mark Dickinson
Mark Dickinson added the comment: > Maybe issue38106 related. That looks plausible, but unfortunately I'm still able to reproduce the hang with your PR (commit 9b135c02aa1edab4c99c915c43cd62d988f1f9c1, macOS 10.14.6). -- ___ Python

[issue26360] Deadlock in thread.join on Python 2.7/macOS

2019-09-14 Thread Mark Dickinson
Change by Mark Dickinson : -- title: Deadlock in thread.join on Python 2.7/Mac OS X 10.9, 10.10 -> Deadlock in thread.join on Python 2.7/macOS ___ Python tracker <https://bugs.python.org/issu

[issue38171] super() is passing wrong parameters while handling diamond inheritance

2019-09-14 Thread Mark Dickinson
Mark Dickinson added the comment: This isn't a bug: super is behaving as designed and as intended here, and indeed with a diamond inheritance structure you'll see super calling "across" from one class to its sibling. That's part of how it works. There's lots o

[issue38171] super() is passing wrong parameters while handling diamond inheritance

2019-09-14 Thread Mark Dickinson
Change by Mark Dickinson : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue26360] Deadlock in thread.join on Python 2.7/macOS

2019-09-14 Thread Mark Dickinson
Mark Dickinson added the comment: FWIW, I've confirmed again that the exact same script on the same machine seems fine under Python 3.x. Given the imminent demise of Python 2, perhaps this issue is just destined to be an unsolved historical o

[issue38181] some trable with max when np.nan is in the first of a list

2019-09-16 Thread Mark Dickinson
Mark Dickinson added the comment: Right, `max` can only give meaningful results when presented with elements that belong to a totally-ordered collection. Unfortunately, floats-including-nan is not such a collection (though floats-excluding-nan *is*, provided we ignore wrinkles with positive

[issue38181] some trable with max when np.nan is in the first of a list

2019-09-16 Thread Mark Dickinson
Change by Mark Dickinson : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue38237] Expose meaningful keyword arguments for pow()

2019-09-20 Thread Mark Dickinson
Mark Dickinson added the comment: The proposal sounds reasonable to me. > should a similar change be made for `math.pow` for consistency's sake? I'd leave math.pow alone here. -- ___ Python tracker <https://bugs.pytho

[issue38308] Add optional weighting to statistics.harmonic_mean()

2019-09-29 Thread Mark Dickinson
Change by Mark Dickinson : -- nosy: +mark.dickinson ___ Python tracker <https://bugs.python.org/issue38308> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue38315] Provide defaultdict variant that passes key to default_factory

2019-09-29 Thread Mark Amery
New submission from Mark Amery : There seems to be at least some demand for the ability to have the key being accessed be passed to the factory function of a defaultdict. See e.g. https://stackoverflow.com/q/2912231/1709587 (13k views) or previous enhancement suggestion https

[issue38315] Provide defaultdict variant that passes key to default_factory

2019-09-30 Thread Mark Amery
Mark Amery added the comment: I'm aware of __missing__. However, I don't think its existence is by itself a knockdown argument against doing this. __missing__ also fulfils the need satisfied by defaultdict, yet Python still has both - and the latter is almost always more conveni

[issue38370] An array as attribute of an object is shared between instances

2019-10-04 Thread Mark Dickinson
Mark Dickinson added the comment: This is a common gotcha. Take a look at: https://docs.python.org/3/faq/programming.html#why-are-default-values-shared-between-objects -- nosy: +mark.dickinson resolution: -> not a bug stage: -> resolved status: open -&g

[issue26219] implement per-opcode cache in ceval

2019-10-07 Thread Mark Shannon
Mark Shannon added the comment: "What's new in Python 3.8" says that this change speeds up the LOAD_GLOBAL opcode by 40%. That seems meaningless as a program cannot have LOAD_GLOBAL in isolation so any test would have other bytecodes as well. What's the evidence for

[issue26219] implement per-opcode cache in ceval

2019-10-07 Thread Mark Shannon
Mark Shannon added the comment: Given that def foo(): int; str; bytes; float; int; str; bytes; float can be trivially be rewritten as def foo(): pass I think that benchmark is meaningless. I really don't think we should be making claims like "40% speedup" for such contrive

[issue36075] python 2to3 conversion tool is generating file with extra line for every input line

2019-10-08 Thread Mark Dickinson
Mark Dickinson added the comment: Looks like a duplicate of #34108 -- nosy: +mark.dickinson ___ Python tracker <https://bugs.python.org/issue36075> ___ ___ Pytho

[issue36075] python 2to3 conversion tool is generating file with extra line for every input line

2019-10-08 Thread Mark Dickinson
Mark Dickinson added the comment: Closing as duplicate. @sabakauser: if you update to a recent Python 3.7 (anything more recent than 3.7.1 should be enough), you should find that this is fixed. -- resolution: -> duplicate stage: -> resolved status: open -> closed s

[issue38382] statistics.harmonic_mean fails to raise error with negative input that follows a 0

2019-10-09 Thread Mark Dickinson
Mark Dickinson added the comment: > In [20]: harmonic_mean([math.nan, 0]) > > Out[20]: 0 That one seems excusable, for the same sort of reasons that IEEE 754 specifies that hypot(nan, inf) is inf rather than nan. Similarly, sumSquare a

[issue38474] digit check logic can be replaced by Py_ISDIGIT on prepare_s

2019-10-15 Thread Mark Dickinson
Mark Dickinson added the comment: > Rewriting all this code just because we have Py_ISDIGIT() is a code churn. I'm inclined to agree: the current code works and is efficient; there's no strong reason to change it. -- ___ Python tr

[issue35714] Document that the null character '\0' terminates a struct format spec

2019-10-26 Thread Mark Dickinson
Mark Dickinson added the comment: I agree with Serhiy. Any other unrecognised character would raise an error. The null character should do the same. -- nosy: +mark.dickinson ___ Python tracker <https://bugs.python.org/issue35

[issue38606] Function to count total number of common divisors of two numbers

2019-10-27 Thread Mark Dickinson
Mark Dickinson added the comment: Thank you for the suggestion. I don't think this fits that well with the view of the math module as a set of basic building blocks: this is quite a specialist function that wouldn't come up often in applications. -- nosy: +mark

[issue38606] Function to count total number of common divisors of two numbers

2019-10-27 Thread Mark Dickinson
Mark Dickinson added the comment: Sorry, but I'm rejecting this: I don't think this is likely to have value to a range of users, and it's not a basic building block - as such, it doesn't really fit with the current design and intended usage of the math module. You might

[issue36666] threading.Thread should have way to catch an exception thrown within

2019-10-29 Thread Mark Borgerding
Mark Borgerding added the comment: @pitrou I don't necessarily agree that "current behavior can't be changed". One major selling point of exceptions is that they cannot be accidentally ignored. The exception is how the current threading.Thread ignores them. You are c

[issue36666] threading.Thread should have way to catch an exception thrown within

2019-10-29 Thread Mark Borgerding
Mark Borgerding added the comment: I'm not trying to disrespect anyone: not users nor certainly Python developers. I have loved Python since I learned it in 2001. I was merely trying to respond to what seemed like an automatic rejection of changing legacy behavior. I certainly

[issue38629] float is missing __ceil__() and __floor__(), required by numbers.Real

2019-10-29 Thread Mark Dickinson
Mark Dickinson added the comment: > I have doubts about adding a C code which is never even executed. My reading of the PR is that it *would* be executed: the math module first looks for the __floor__ special method, then falls back to using the libm floor if that doesn't exi

[issue38629] float is missing __ceil__() and __floor__(), required by numbers.Real

2019-10-29 Thread Mark Dickinson
Mark Dickinson added the comment: > If float.__ceil__ will be executed it will add significant overhead for > creating and executing the method object. Yes, I'd definitely like to see timings; I think Victor already asked for those

[issue38382] statistics.harmonic_mean fails to raise error with negative input that follows a 0

2019-10-30 Thread Mark Dickinson
Mark Dickinson added the comment: > Maybe we should hold-off on adding negative number support unless a > compelling use case arises. +100. It makes little sense mathematically, and I'm sceptical that such use cases exist i

[issue38657] String format for hexadecimal notation breaks padding with alternative form

2019-11-01 Thread Mark Dickinson
Change by Mark Dickinson : -- nosy: +mark.dickinson ___ Python tracker <https://bugs.python.org/issue38657> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue38500] Provide a way to get/set PyInterpreterState.frame_eval without needing to access interpreter internals

2019-11-04 Thread Mark Shannon
Mark Shannon added the comment: I'm strongly opposed to this change. PEP 523 does not specify what the semantics of changing the interpreter frame evaluator actually is: Is the VM obliged to call the new interpreter? What happens if the custom evaluator leaves the VM in a inconsistent

[issue38500] Provide a way to get/set PyInterpreterState.frame_eval without needing to access interpreter internals

2019-11-04 Thread Mark Shannon
Mark Shannon added the comment: Fabio, OOI what are you trying achieve by changing the frame evaluator? -- ___ Python tracker <https://bugs.python.org/issue38

[issue38703] should we expect round(0.95, 1) to be 1.0, instead of 0.9?

2019-11-05 Thread Mark Dickinson
Mark Dickinson added the comment: What Serhiy said. round is behaving as intended and as designed here. Note: you can also see the actual value of a float object easily by using Decimal: >>> from decimal import Decimal >>> Decimal

[issue38703] should we expect round(0.95, 1) to be 1.0, instead of 0.9?

2019-11-06 Thread Mark Dickinson
Mark Dickinson added the comment: [Steven] py> '%.17f' % 0.95 '0.94996' That's tricky to use correctly: it's not a priori clear how many digits after the point are needed to give you a faithful representation (the "17" in "%.

[issue38500] Provide a way to get/set PyInterpreterState.frame_eval without needing to access interpreter internals

2019-11-07 Thread Mark Shannon
Mark Shannon added the comment: Victor, I don't think this is a regression. `PyThreadState` is an internal opaque data structure, which means we are free to change it. That the `eval_frame` is hard to access is a feature not a bug, as it discourages misuse and enables us to remove it e

[issue38706] What should the error message in the exception raised by assertTrue and assertFalse be?

2019-11-07 Thread Mark Dickinson
Mark Dickinson added the comment: [Terry] > A correct failure message, correct both as English and Python, should be > something like 'bool(x) is not True'. I see 'x is not true' as an informal > English equivalent of the full claim. I'm not clea

[issue43475] Worst-case behaviour of hash collision with float NaN

2021-03-11 Thread Mark Dickinson
Change by Mark Dickinson : -- nosy: +mark.dickinson ___ Python tracker <https://bugs.python.org/issue43475> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue43475] Worst-case behaviour of hash collision with float NaN

2021-03-11 Thread Mark Dickinson
Mark Dickinson added the comment: Sigh. When I'm undisputed ruler of the multiverse, I'm going to make "NaN == NaN" return True, IEEE 754 be damned. NaN != NaN is fine(ish) at the level of numerics; the problems start when the consequences of that choice leak into the

[issue43475] Worst-case behaviour of hash collision with float NaN

2021-03-11 Thread Mark Dickinson
Mark Dickinson added the comment: Hmm. On second thoughts, the proposed solution wouldn't actually *help* with the situation I gave: the elements (lazily) realised from the NumPy array are highly likely to all end up with the same address in RAM. :-( >>> x = np.full(10, np.nan

[issue43475] Worst-case behaviour of hash collision with float NaN

2021-03-11 Thread Mark Dickinson
Mark Dickinson added the comment: On third thoughts, of course it *would* help, because the Counter is keeping references to the realised NaN values. I think I'll go away now and come back when my brain is working. -- ___ Python tracker &

<    26   27   28   29   30   31   32   33   34   35   >