Skip to content

Counter for JUMP_BACKWARD is initialized to 17 instead of 0 #108488

Closed
@gvanrossum

Description

@gvanrossum

Bug report

CPython versions tested on:

CPython main branch

Operating systems tested on:

macOS

Output from running 'python -VV' on the command line:

Python 3.13.0a0 (heads/main-dirty:5a25daa512, Aug 25 2023, 21:20:04) [Clang 14.0.3 (clang-1403.0.22.14.1)]

A clear and concise description of the bug:

From #108311 (comment):

FWIW I also discovered that the JUMP_BACKWARD counter is initialized to 17 (the constant computed by adaptive_counter_warmup()), like all other counters, by _PyCode_Quicken() in specialize.c. Arguably, since this counter is supposed to count upwards from zero (in steps of 16, i.e. 1 << OPTIMIZER_BITS_IN_COUNTER), it ought to be initialized to zero (as I had expected it would be). But this ought to be a separate issue and PR.

Linked PRs

Metadata

Metadata

Labels

type-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions