Skip to content

Add cdef type declarations and inline upgrade check in HTTP parser#12321

Draft
bdraco wants to merge 2 commits intoaio-libs:masterfrom
bdraco:cython-type-declarations-http-parser
Draft

Add cdef type declarations and inline upgrade check in HTTP parser#12321
bdraco wants to merge 2 commits intoaio-libs:masterfrom
bdraco:cython-type-declarations-http-parser

Conversation

@bdraco
Copy link
Copy Markdown
Member

@bdraco bdraco commented Apr 6, 2026

What do these changes do?

Add cdef type declarations for h_upg and enc local variables in _on_headers_complete, and inline the allowed variable into the conditional check. Noticed while reviewing #11966

Are there changes in behavior for the user?

No behavior changes; this is a minor optimization to help Cython generate better C code.

Is it a substantial burden for the maintainers to support this?

No, this is a small change with no maintenance burden.

Related issue number

N/A

Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes
  • If you provide code modification, please add yourself to CONTRIBUTORS.txt
    • The format is <Name> <Surname>.
    • Please keep alphabetical order, the file is sorted by names.
  • Add a new news fragment into the CHANGES/ folder
    • name it <issue_or_pr_num>.<type>.rst (e.g. 588.bugfix.rst)

    • if you don't have an issue number, change it to the pull request
      number after creating the PR

      • .bugfix: A bug fix for something the maintainers deemed an
        improper undesired behavior that got corrected to match
        pre-agreed expectations.
      • .feature: A new behavior, public APIs. That sort of stuff.
      • .deprecation: A declaration of future API removals and breaking
        changes in behavior.
      • .breaking: When something public is removed in a breaking way.
        Could be deprecated in an earlier release.
      • .doc: Notable updates to the documentation structure or build
        process.
      • .packaging: Notes for downstreams about unobvious side effects
        and tooling. Changes in the test invocation considerations and
        runtime assumptions.
      • .contrib: Stuff that affects the contributor experience. e.g.
        Running tests, building the docs, setting up the development
        environment.
      • .misc: Changes that are hard to assign to any of the above
        categories.
    • Make sure to use full sentences with correct case and punctuation,
      for example:

      Fixed issue with non-ascii contents in doctest text files
      -- by :user:`contributor-gh-handle`.

      Use the past tense or the present tense a non-imperative mood,
      referring to what's changed compared to the last released version
      of this project.

@bdraco bdraco added backport-3.13 Trigger automatic backporting to the 3.13 release branch by Patchback robot backport-3.14 Trigger automatic backporting to the 3.14 release branch by Patchback robot labels Apr 6, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.11%. Comparing base (d9bd1be) to head (dc99fd7).
⚠️ Report is 1 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #12321   +/-   ##
=======================================
  Coverage   99.11%   99.11%           
=======================================
  Files         130      130           
  Lines       45558    45558           
  Branches     2404     2404           
=======================================
+ Hits        45155    45156    +1     
  Misses        272      272           
+ Partials      131      130    -1     
Flag Coverage Δ
CI-GHA 98.97% <ø> (+<0.01%) ⬆️
OS-Linux 98.71% <ø> (ø)
OS-Windows 96.99% <ø> (ø)
OS-macOS 97.87% <ø> (+<0.01%) ⬆️
Py-3.10.11 97.42% <ø> (+<0.01%) ⬆️
Py-3.10.20 97.89% <ø> (ø)
Py-3.11.15 98.09% <ø> (-0.01%) ⬇️
Py-3.11.9 97.63% <ø> (+<0.01%) ⬆️
Py-3.12.10 97.71% <ø> (-0.01%) ⬇️
Py-3.12.13 98.19% <ø> (ø)
Py-3.13.12 98.44% <ø> (-0.01%) ⬇️
Py-3.14.3 98.49% <ø> (ø)
Py-3.14.3t 97.50% <ø> (-0.01%) ⬇️
Py-pypy3.11.15-7.3.21 97.38% <ø> (+<0.01%) ⬆️
VM-macos 97.87% <ø> (+<0.01%) ⬆️
VM-ubuntu 98.71% <ø> (ø)
VM-windows 96.99% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Apr 6, 2026

Merging this PR will not alter performance

✅ 59 untouched benchmarks


Comparing bdraco:cython-type-declarations-http-parser (dc99fd7) with master (e412ccb)

Open in CodSpeed

@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Apr 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-3.13 Trigger automatic backporting to the 3.13 release branch by Patchback robot backport-3.14 Trigger automatic backporting to the 3.14 release branch by Patchback robot bot:chronographer:provided There is a change note present in this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants