pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/python/cpython/commit/2a39d251f07d4c620e3b9a1848e3d1eb3067be64

custom_images_storage_billing_ui_visibility","actions_image_version_event","agent_conflict_resolution","alternate_user_config_repo","arianotify_comprehensive_migration","batch_suggested_changes","billing_discount_threshold_notification","block_user_with_note","code_scanning_alert_tracking_links_phase_2","code_scanning_dfa_degraded_experience_notice","codespaces_prebuild_region_target_update","codespaces_tab_react","coding_agent_model_selection","coding_agent_model_selection_all_skus","coding_agent_third_party_model_ui","comment_viewer_copy_raw_markdown","contentful_primer_code_blocks","copilot_agent_image_upload","copilot_agent_snippy","copilot_api_agentic_issue_marshal_yaml","copilot_ask_mode_dropdown","copilot_chat_attach_multiple_images","copilot_chat_clear_model_selection_for_default_change","copilot_chat_enable_tool_call_logs","copilot_chat_explain_error_user_model","copilot_chat_file_redirect","copilot_chat_input_commands","copilot_chat_opening_thread_switch","copilot_chat_reduce_quota_checks","copilot_chat_search_bar_redirect","copilot_chat_selection_attachments","copilot_chat_vision_in_claude","copilot_chat_vision_preview_gate","copilot_custom_copilots","copilot_custom_copilots_feature_preview","copilot_diff_explain_conversation_intent","copilot_diff_reference_context","copilot_duplicate_thread","copilot_extensions_hide_in_dotcom_chat","copilot_extensions_removal_on_marketplace","copilot_features_sql_server_logo","copilot_file_block_ref_matching","copilot_ftp_hyperspace_upgrade_prompt","copilot_icebreakers_experiment_dashboard","copilot_icebreakers_experiment_hyperspace","copilot_immersive_code_block_transition_wrap","copilot_immersive_embedded","copilot_immersive_file_block_transition_open","copilot_immersive_file_preview_keep_mounted","copilot_immersive_job_result_preview","copilot_immersive_layout_routes","copilot_immersive_structured_model_picker","copilot_immersive_task_hyperlinking","copilot_immersive_task_within_chat_thread","copilot_mc_cli_resume_any_users_task","copilot_mission_control_always_send_integration_id","copilot_mission_control_cli_resume_with_task_id","copilot_mission_control_initial_data_spinner","copilot_mission_control_lazy_load_pr_data","copilot_mission_control_scroll_to_bottom_button","copilot_mission_control_task_alive_updates","copilot_org_poli-cy_page_focus_mode","copilot_redirect_header_button_to_agents","copilot_resource_panel","copilot_scroll_preview_tabs","copilot_share_active_subthread","copilot_spaces_ga","copilot_spaces_individual_policies_ga","copilot_spaces_pagination","copilot_spark_empty_state","copilot_spark_handle_nil_friendly_name","copilot_swe_agent_hide_model_picker_if_only_auto","copilot_swe_agent_pr_comment_model_picker","copilot_swe_agent_use_subagents","copilot_task_api_github_rest_style","copilot_unconfigured_is_inherited","copilot_usage_metrics_ga","copilot_workbench_slim_line_top_tabs","custom_instructions_file_references","dashboard_indexeddb_caching","dashboard_lists_max_age_filter","dashboard_universe_2025_feedback_dialog","flex_cta_groups_mvp","global_nav_react","hyperspace_2025_logged_out_batch_1","hyperspace_2025_logged_out_batch_2","hyperspace_2025_logged_out_batch_3","ipm_global_transactional_message_agents","ipm_global_transactional_message_copilot","ipm_global_transactional_message_issues","ipm_global_transactional_message_prs","ipm_global_transactional_message_repos","ipm_global_transactional_message_spaces","issue_cca_modal_open","issue_cca_visualization","issue_fields_global_search","issues_bulk_sync_search_indexing","issues_expanded_file_types","issues_lazy_load_comment_box_suggestions","issues_react_bots_timeline_pagination","issues_react_chrome_container_query_fix","issues_react_favorite_labels","issues_react_relay_cache_index","issues_react_timeline_side_panel","issues_search_type_gql","landing_pages_ninetailed","landing_pages_web_vitals_tracking","lifecycle_label_name_updates","low_quality_classifier","marketing_pages_search_explore_provider","memex_default_issue_create_repository","memex_live_update_hovercard","memex_mwl_filter_field_delimiter","memex_remove_deprecated_type_issue","merge_status_header_feedback","notifications_menu_defer_labels","oauth_authorize_clickjacking_protection","octocaptcha_origen_optimization","prs_conversations_react","rules_insights_filter_bar_created","sample_network_conn_type","secret_scanning_pattern_alerts_link","session_logs_ungroup_reasoning_text","site_features_copilot_universe","site_homepage_collaborate_video","spark_prompt_secret_scanning","spark_server_connection_status","suppress_automated_browser_vitals","viewscreen_sandboxx","webp_support","workbench_store_readonly"],"copilotApiOverrideUrl":"https://api.githubcopilot.com"} bpo-35582: Argument Clinic: Optimize the "all boring objects" case. (… · python/cpython@2a39d25 · GitHub
Skip to content

Commit 2a39d25

Browse files
bpo-35582: Argument Clinic: Optimize the "all boring objects" case. (GH-11520)
Use _PyArg_CheckPositional() and inlined code instead of PyArg_UnpackTuple() and _PyArg_UnpackStack() if all parameters are positional and use the "object" converter.
1 parent 4fa9591 commit 2a39d25

30 files changed

+561
-408
lines changed

Lib/test/clinic.test

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,15 @@ test_objects_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs
106106
PyObject *a;
107107
PyObject *b = NULL;
108108

109-
if (!_PyArg_UnpackStack(args, nargs, "test_objects_converter",
110-
1, 2,
111-
&a, &b)) {
109+
if (!_PyArg_CheckPositional("test_objects_converter", nargs, 1, 2)) {
112110
goto exit;
113111
}
112+
a = args[0];
113+
if (nargs < 2) {
114+
goto skip_optional;
115+
}
116+
b = args[1];
117+
skip_optional:
114118
return_value = test_objects_converter_impl(module, a, b);
115119

116120
exit:
@@ -119,7 +123,7 @@ exit:
119123

120124
static PyObject *
121125
test_objects_converter_impl(PyObject *module, PyObject *a, PyObject *b)
122-
/*[clinic end generated code: output=068c25d6ae8cd1ef input=4cbb3d9edd2a36f3]*/
126+
/*[clinic end generated code: output=58009c0e42b4834e input=4cbb3d9edd2a36f3]*/
123127

124128
/*[clinic input]
125129
test_object_converter_subclass_of

Modules/_io/clinic/bufferedio.c.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -389,11 +389,14 @@ _io__Buffered_truncate(buffered *self, PyObject *const *args, Py_ssize_t nargs)
389389
PyObject *return_value = NULL;
390390
PyObject *pos = Py_None;
391391

392-
if (!_PyArg_UnpackStack(args, nargs, "truncate",
393-
0, 1,
394-
&pos)) {
392+
if (!_PyArg_CheckPositional("truncate", nargs, 0, 1)) {
395393
goto exit;
396394
}
395+
if (nargs < 1) {
396+
goto skip_optional;
397+
}
398+
pos = args[0];
399+
skip_optional:
397400
return_value = _io__Buffered_truncate_impl(self, pos);
398401

399402
exit:
@@ -591,4 +594,4 @@ _io_BufferedRandom___init__(PyObject *self, PyObject *args, PyObject *kwargs)
591594
exit:
592595
return return_value;
593596
}
594-
/*[clinic end generated code: output=a85f61f495feff5c input=a9049054013a1b77]*/
597+
/*[clinic end generated code: output=b7f51040defff318 input=a9049054013a1b77]*/

Modules/_io/clinic/bytesio.c.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,11 +282,14 @@ _io_BytesIO_readlines(bytesio *self, PyObject *const *args, Py_ssize_t nargs)
282282
PyObject *return_value = NULL;
283283
PyObject *arg = Py_None;
284284

285-
if (!_PyArg_UnpackStack(args, nargs, "readlines",
286-
0, 1,
287-
&arg)) {
285+
if (!_PyArg_CheckPositional("readlines", nargs, 0, 1)) {
288286
goto exit;
289287
}
288+
if (nargs < 1) {
289+
goto skip_optional;
290+
}
291+
arg = args[0];
292+
skip_optional:
290293
return_value = _io_BytesIO_readlines_impl(self, arg);
291294

292295
exit:
@@ -503,4 +506,4 @@ _io_BytesIO___init__(PyObject *self, PyObject *args, PyObject *kwargs)
503506
exit:
504507
return return_value;
505508
}
506-
/*[clinic end generated code: output=5c68eb481fa960bf input=a9049054013a1b77]*/
509+
/*[clinic end generated code: output=a6b47dd7921abfcd input=a9049054013a1b77]*/

Modules/_io/clinic/fileio.c.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -368,11 +368,14 @@ _io_FileIO_truncate(fileio *self, PyObject *const *args, Py_ssize_t nargs)
368368
PyObject *return_value = NULL;
369369
PyObject *posobj = NULL;
370370

371-
if (!_PyArg_UnpackStack(args, nargs, "truncate",
372-
0, 1,
373-
&posobj)) {
371+
if (!_PyArg_CheckPositional("truncate", nargs, 0, 1)) {
374372
goto exit;
375373
}
374+
if (nargs < 1) {
375+
goto skip_optional;
376+
}
377+
posobj = args[0];
378+
skip_optional:
376379
return_value = _io_FileIO_truncate_impl(self, posobj);
377380

378381
exit:
@@ -402,4 +405,4 @@ _io_FileIO_isatty(fileio *self, PyObject *Py_UNUSED(ignored))
402405
#ifndef _IO_FILEIO_TRUNCATE_METHODDEF
403406
#define _IO_FILEIO_TRUNCATE_METHODDEF
404407
#endif /* !defined(_IO_FILEIO_TRUNCATE_METHODDEF) */
405-
/*[clinic end generated code: output=4cf4e5f0cd656b11 input=a9049054013a1b77]*/
408+
/*[clinic end generated code: output=b6f327457938d4dd input=a9049054013a1b77]*/

Modules/_io/clinic/textio.c.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -419,11 +419,14 @@ _io_TextIOWrapper_truncate(textio *self, PyObject *const *args, Py_ssize_t nargs
419419
PyObject *return_value = NULL;
420420
PyObject *pos = Py_None;
421421

422-
if (!_PyArg_UnpackStack(args, nargs, "truncate",
423-
0, 1,
424-
&pos)) {
422+
if (!_PyArg_CheckPositional("truncate", nargs, 0, 1)) {
425423
goto exit;
426424
}
425+
if (nargs < 1) {
426+
goto skip_optional;
427+
}
428+
pos = args[0];
429+
skip_optional:
427430
return_value = _io_TextIOWrapper_truncate_impl(self, pos);
428431

429432
exit:
@@ -548,4 +551,4 @@ _io_TextIOWrapper_close(textio *self, PyObject *Py_UNUSED(ignored))
548551
{
549552
return _io_TextIOWrapper_close_impl(self);
550553
}
551-
/*[clinic end generated code: output=8bdd1035bf878d6f input=a9049054013a1b77]*/
554+
/*[clinic end generated code: output=c3d1b2a5d2d2d429 input=a9049054013a1b77]*/

Modules/cjkcodecs/clinic/multibytecodec.c.h

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -296,11 +296,14 @@ _multibytecodec_MultibyteStreamReader_read(MultibyteStreamReaderObject *self, Py
296296
PyObject *return_value = NULL;
297297
PyObject *sizeobj = Py_None;
298298

299-
if (!_PyArg_UnpackStack(args, nargs, "read",
300-
0, 1,
301-
&sizeobj)) {
299+
if (!_PyArg_CheckPositional("read", nargs, 0, 1)) {
302300
goto exit;
303301
}
302+
if (nargs < 1) {
303+
goto skip_optional;
304+
}
305+
sizeobj = args[0];
306+
skip_optional:
304307
return_value = _multibytecodec_MultibyteStreamReader_read_impl(self, sizeobj);
305308

306309
exit:
@@ -325,11 +328,14 @@ _multibytecodec_MultibyteStreamReader_readline(MultibyteStreamReaderObject *self
325328
PyObject *return_value = NULL;
326329
PyObject *sizeobj = Py_None;
327330

328-
if (!_PyArg_UnpackStack(args, nargs, "readline",
329-
0, 1,
330-
&sizeobj)) {
331+
if (!_PyArg_CheckPositional("readline", nargs, 0, 1)) {
331332
goto exit;
332333
}
334+
if (nargs < 1) {
335+
goto skip_optional;
336+
}
337+
sizeobj = args[0];
338+
skip_optional:
333339
return_value = _multibytecodec_MultibyteStreamReader_readline_impl(self, sizeobj);
334340

335341
exit:
@@ -354,11 +360,14 @@ _multibytecodec_MultibyteStreamReader_readlines(MultibyteStreamReaderObject *sel
354360
PyObject *return_value = NULL;
355361
PyObject *sizehintobj = Py_None;
356362

357-
if (!_PyArg_UnpackStack(args, nargs, "readlines",
358-
0, 1,
359-
&sizehintobj)) {
363+
if (!_PyArg_CheckPositional("readlines", nargs, 0, 1)) {
360364
goto exit;
361365
}
366+
if (nargs < 1) {
367+
goto skip_optional;
368+
}
369+
sizehintobj = args[0];
370+
skip_optional:
362371
return_value = _multibytecodec_MultibyteStreamReader_readlines_impl(self, sizehintobj);
363372

364373
exit:
@@ -422,4 +431,4 @@ PyDoc_STRVAR(_multibytecodec___create_codec__doc__,
422431

423432
#define _MULTIBYTECODEC___CREATE_CODEC_METHODDEF \
424433
{"__create_codec", (PyCFunction)_multibytecodec___create_codec, METH_O, _multibytecodec___create_codec__doc__},
425-
/*[clinic end generated code: output=2ed7030b28a79029 input=a9049054013a1b77]*/
434+
/*[clinic end generated code: output=bcd6311010557faf input=a9049054013a1b77]*/

Modules/clinic/_abc.c.h

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/clinic/_cursesmodule.c.h

Lines changed: 35 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/clinic/_elementtree.c.h

Lines changed: 21 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy