Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decrement the refcount of PyLong_FromLong(1) in the correct branch #97

Merged
merged 1 commit into from
Dec 21, 2020

Conversation

pablogsal
Copy link
Contributor

@pablogsal
Copy link
Contributor Author

CC: @pganssle

@pablogsal pablogsal changed the title Decrement the refcount of _PyLong_One in the correct branch Decrement the refcount of PyLong_FromLong(1) in the correct branch Dec 21, 2020
@pganssle pganssle merged commit f131cee into pganssle:master Dec 21, 2020
@pganssle
Copy link
Owner

pganssle commented Dec 21, 2020

Here is an MWE of the issue:

from backports.zoneinfo import ZoneInfo
from datetime import datetime, timezone

class SubDT(datetime):
    pass

LON = ZoneInfo("Europe/London")
d = SubDT(2020, 10, 25, 1, 30, tzinfo=timezone.utc)

# Each pass through the loop inappropriately reduces the reference count on the
# `1` object by 1. Since there are usually a large number of live references to
# `1`, this won't have any immediate noticeable effect unless you do it a lot.
for i in range(10000):
    d.astimezone(LON)

freebsd-git pushed a commit to freebsd/freebsd-ports that referenced this pull request Jun 25, 2022
We already have Python 3.7 as minimal supported release, so
force #ifdef's for 3.7+ API as always positive to prevent use deprecated types

While here, port upstream patch for MR#97 (pganssle/zoneinfo#97)
"Decrement the refcount of _PyLong_One in the correct branch"
ocochard pushed a commit to ocochard/freebsd-ports that referenced this pull request Jul 6, 2022
We already have Python 3.7 as minimal supported release, so
force #ifdef's for 3.7+ API as always positive to prevent use deprecated types

While here, port upstream patch for MR#97 (pganssle/zoneinfo#97)
"Decrement the refcount of _PyLong_One in the correct branch"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants