Skip to content

Conversation

@ethanfurman
Copy link
Member

The index_pages parameter has been removed from __init__ as subclassing is the encouraged method for modifying SimpleHttpRequestHandler.

index_pages should be a tuple of 0 or more strings (not sure I have the type hint correct).

@github-actions

This comment has been minimized.

@AlexWaygood
Copy link
Member

AlexWaygood commented Jan 3, 2023

The index_pages parameter has been removed from __init__ as subclassing is the encouraged method for modifying SimpleHttpRequestHandler.

But the parameter does nonetheless exist on the CPython main branch, no? :) https://github.com/python/cpython/blob/64ed609c532a12b27f67a1e12e9e02f136ee3a94/Lib/http/server.py#L664

We tend to be descriptive rather than prescriptive in typeshed. If a parameter exists at runtime, we tend to include it in the stub, even if it's not considered great style to use that parameter at runtime. If we do otherwise, people tend to complain loudly at us. It also means we have to switch off some of our tests that check that the stub is consistent with the runtime, and switching off those tests means our stubs become vulnerable to silently growing out of date without us noticing.

(You don't see those tests failing on this PR because we haven't switched them on yet for 3.12, since 3.12 is still in development.)

@ethanfurman
Copy link
Member Author

PR changing __init__ has now been merged. :-)

@AlexWaygood
Copy link
Member

PR changing __init__ has now been merged. :-)

Ah! I didn't realise there was a pending PR :)

@JelleZijlstra
Copy link
Member

Maybe we're being a bit early with the 3.12 features here :) We can make this change though now that main has been changed.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@github-actions
Copy link
Contributor

github-actions bot commented Jan 3, 2023

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@AlexWaygood AlexWaygood merged commit 3aceb1a into python:main Jan 3, 2023
@ethanfurman ethanfurman deleted the http branch January 4, 2023 00:03
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.

3 participants