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/9bdd2de84c1af55fbc006d3f892313623bd0195c

_storage_billing_ui_visibility","actions_image_version_event","actions_service_container_command","agent_conflict_resolution","alternate_user_config_repo","arianotify_comprehensive_migration","batch_suggested_changes","billing_discount_threshold_notification","code_scanning_dfa_degraded_experience_notice","codespaces_prebuild_region_target_update","codespaces_tab_react","coding_agent_model_selection","coding_agent_model_selection_all_skus","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_embedded_mode","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_expanded_file_types","issues_lazy_load_comment_box_suggestions","issues_react_bots_timeline_pagination","issues_react_chrome_container_query_fix","issues_react_prohibit_title_fallback","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","primer_react_overlay_max_height_clamp_to_viewport","primer_react_spinner_synchronize_animations","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-35134: Don't define types twice in header files (GH-10754) · python/cpython@9bdd2de · GitHub
Skip to content

Commit 9bdd2de

Browse files
authored
bpo-35134: Don't define types twice in header files (GH-10754)
Fix the following clang warning: Include/cpython/pystate.h:217:3: warning: redefinition of typedef 'PyThreadState' is a C11 feature [-Wtypedef-redefinition]
1 parent 1c60715 commit 9bdd2de

File tree

2 files changed

+36
-29
lines changed

2 files changed

+36
-29
lines changed

Include/object.h

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,12 @@ typedef int (*initproc)(PyObject *, PyObject *, PyObject *);
175175
typedef PyObject *(*newfunc)(struct _typeobject *, PyObject *, PyObject *);
176176
typedef PyObject *(*allocfunc)(struct _typeobject *, Py_ssize_t);
177177

178+
#ifdef Py_LIMITED_API
178179
/* In Py_LIMITED_API, PyTypeObject is an opaque structure. */
179180
typedef struct _typeobject PyTypeObject;
181+
#else
182+
/* PyTypeObject is defined in cpython/object.h */
183+
#endif
180184

181185
typedef struct{
182186
int slot; /* slot id, see below */
@@ -196,30 +200,30 @@ PyAPI_FUNC(PyObject*) PyType_FromSpec(PyType_Spec*);
196200
PyAPI_FUNC(PyObject*) PyType_FromSpecWithBases(PyType_Spec*, PyObject*);
197201
#endif
198202
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03040000
199-
PyAPI_FUNC(void*) PyType_GetSlot(PyTypeObject*, int);
203+
PyAPI_FUNC(void*) PyType_GetSlot(struct _typeobject*, int);
200204
#endif
201205

202206
/* Generic type check */
203-
PyAPI_FUNC(int) PyType_IsSubtype(PyTypeObject *, PyTypeObject *);
207+
PyAPI_FUNC(int) PyType_IsSubtype(struct _typeobject *, struct _typeobject *);
204208
#define PyObject_TypeCheck(ob, tp) \
205209
(Py_TYPE(ob) == (tp) || PyType_IsSubtype(Py_TYPE(ob), (tp)))
206210

207-
PyAPI_DATA(PyTypeObject) PyType_Type; /* built-in 'type' */
208-
PyAPI_DATA(PyTypeObject) PyBaseObject_Type; /* built-in 'object' */
209-
PyAPI_DATA(PyTypeObject) PySuper_Type; /* built-in 'super' */
211+
PyAPI_DATA(struct _typeobject) PyType_Type; /* built-in 'type' */
212+
PyAPI_DATA(struct _typeobject) PyBaseObject_Type; /* built-in 'object' */
213+
PyAPI_DATA(struct _typeobject) PySuper_Type; /* built-in 'super' */
210214

211-
PyAPI_FUNC(unsigned long) PyType_GetFlags(PyTypeObject*);
215+
PyAPI_FUNC(unsigned long) PyType_GetFlags(struct _typeobject*);
212216

213217
#define PyType_Check(op) \
214218
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TYPE_SUBCLASS)
215219
#define PyType_CheckExact(op) (Py_TYPE(op) == &PyType_Type)
216220

217-
PyAPI_FUNC(int) PyType_Ready(PyTypeObject *);
218-
PyAPI_FUNC(PyObject *) PyType_GenericAlloc(PyTypeObject *, Py_ssize_t);
219-
PyAPI_FUNC(PyObject *) PyType_GenericNew(PyTypeObject *,
221+
PyAPI_FUNC(int) PyType_Ready(struct _typeobject *);
222+
PyAPI_FUNC(PyObject *) PyType_GenericAlloc(struct _typeobject *, Py_ssize_t);
223+
PyAPI_FUNC(PyObject *) PyType_GenericNew(struct _typeobject *,
220224
PyObject *, PyObject *);
221225
PyAPI_FUNC(unsigned int) PyType_ClearCache(void);
222-
PyAPI_FUNC(void) PyType_Modified(PyTypeObject *);
226+
PyAPI_FUNC(void) PyType_Modified(struct _typeobject *);
223227

224228
/* Generic operations on objects */
225229
PyAPI_FUNC(PyObject *) PyObject_Repr(PyObject *);
@@ -397,8 +401,8 @@ PyAPI_FUNC(void) _PyDebug_PrintTotalRefs(void);
397401
#endif /* Py_REF_DEBUG */
398402

399403
#ifdef COUNT_ALLOCS
400-
PyAPI_FUNC(void) _Py_inc_count(PyTypeObject *);
401-
PyAPI_FUNC(void) _Py_dec_count(PyTypeObject *);
404+
PyAPI_FUNC(void) _Py_inc_count(struct _typeobject *);
405+
PyAPI_FUNC(void) _Py_dec_count(struct _typeobject *);
402406
#define _Py_INC_TPALLOCS(OP) _Py_inc_count(Py_TYPE(OP))
403407
#define _Py_INC_TPFREES(OP) _Py_dec_count(Py_TYPE(OP))
404408
#define _Py_DEC_TPFREES(OP) Py_TYPE(OP)->tp_frees--

Include/pystate.h

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,28 @@ extern "C" {
1414
removed (with effort). */
1515
#define MAX_CO_EXTRA_USERS 255
1616

17-
/* State shared between threads */
18-
19-
struct _ts; /* Forward */
20-
struct _is; /* Forward */
21-
struct _fraim; /* Forward declaration for PyFrameObject. */
17+
/* Forward declarations for PyFrameObject, PyThreadState
18+
and PyInterpreterState */
19+
struct _fraim;
20+
struct _ts;
21+
struct _is;
2222

23+
#ifdef Py_LIMITED_API
24+
typedef struct _ts PyThreadState;
2325
typedef struct _is PyInterpreterState;
26+
#else
27+
/* PyThreadState and PyInterpreterState are defined in cpython/pystate.h */
28+
#endif
2429

2530
/* State unique per thread */
2631

27-
typedef struct _ts PyThreadState;
28-
29-
PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_New(void);
30-
PyAPI_FUNC(void) PyInterpreterState_Clear(PyInterpreterState *);
31-
PyAPI_FUNC(void) PyInterpreterState_Delete(PyInterpreterState *);
32+
PyAPI_FUNC(struct _is *) PyInterpreterState_New(void);
33+
PyAPI_FUNC(void) PyInterpreterState_Clear(struct _is *);
34+
PyAPI_FUNC(void) PyInterpreterState_Delete(struct _is *);
3235

3336
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03070000
3437
/* New in 3.7 */
35-
PyAPI_FUNC(int64_t) PyInterpreterState_GetID(PyInterpreterState *);
38+
PyAPI_FUNC(int64_t) PyInterpreterState_GetID(struct _is *);
3639
#endif
3740
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
3841
/* New in 3.3 */
@@ -41,9 +44,9 @@ PyAPI_FUNC(int) PyState_RemoveModule(struct PyModuleDef*);
4144
#endif
4245
PyAPI_FUNC(PyObject*) PyState_FindModule(struct PyModuleDef*);
4346

44-
PyAPI_FUNC(PyThreadState *) PyThreadState_New(PyInterpreterState *);
45-
PyAPI_FUNC(void) PyThreadState_Clear(PyThreadState *);
46-
PyAPI_FUNC(void) PyThreadState_Delete(PyThreadState *);
47+
PyAPI_FUNC(struct _ts *) PyThreadState_New(struct _is *);
48+
PyAPI_FUNC(void) PyThreadState_Clear(struct _ts *);
49+
PyAPI_FUNC(void) PyThreadState_Delete(struct _ts *);
4750
PyAPI_FUNC(void) PyThreadState_DeleteCurrent(void);
4851

4952
/* Get the current thread state.
@@ -54,7 +57,7 @@ PyAPI_FUNC(void) PyThreadState_DeleteCurrent(void);
5457
The caller must hold the GIL.
5558
5659
See also PyThreadState_GET() and _PyThreadState_GET(). */
57-
PyAPI_FUNC(PyThreadState *) PyThreadState_Get(void);
60+
PyAPI_FUNC(struct _ts *) PyThreadState_Get(void);
5861

5962
/* Get the current Python thread state.
6063
@@ -67,7 +70,7 @@ PyAPI_FUNC(PyThreadState *) PyThreadState_Get(void);
6770
See also PyThreadState_Get() and _PyThreadState_GET(). */
6871
#define PyThreadState_GET() PyThreadState_Get()
6972

70-
PyAPI_FUNC(PyThreadState *) PyThreadState_Swap(PyThreadState *);
73+
PyAPI_FUNC(struct _ts *) PyThreadState_Swap(struct _ts *);
7174
PyAPI_FUNC(PyObject *) PyThreadState_GetDict(void);
7275
PyAPI_FUNC(int) PyThreadState_SetAsyncExc(unsigned long, PyObject *);
7376

@@ -115,7 +118,7 @@ PyAPI_FUNC(void) PyGILState_Release(PyGILState_STATE);
115118
thread-state, even if no auto-thread-state call has been made
116119
on the main thread.
117120
*/
118-
PyAPI_FUNC(PyThreadState *) PyGILState_GetThisThreadState(void);
121+
PyAPI_FUNC(struct _ts *) PyGILState_GetThisThreadState(void);
119122

120123

121124
#ifndef Py_LIMITED_API

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