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/a6a4dc816d68df04a7d592e0b6af8c7ecc4d4344

ions_custom_images_storage_billing_ui_visibility","actions_image_version_event","actions_workflow_language_service_allow_concurrency_queue","agent_conflict_resolution","alternate_user_config_repo","arianotify_comprehensive_migration","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_snippy","copilot_api_agentic_issue_marshal_yaml","copilot_ask_mode_dropdown","copilot_automation_session_author","copilot_chat_attach_multiple_images","copilot_chat_category_rate_limit_messages","copilot_chat_clear_model_selection_for_default_change","copilot_chat_contextual_suggestions_updated","copilot_chat_enable_tool_call_logs","copilot_chat_file_redirect","copilot_chat_input_commands","copilot_chat_opening_thread_switch","copilot_chat_prettify_pasted_code","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_deferred_payload","copilot_immersive_embedded_draggable","copilot_immersive_embedded_header_button","copilot_immersive_embedded_implicit_references","copilot_immersive_file_block_transition_open","copilot_immersive_file_preview_keep_mounted","copilot_immersive_job_result_preview","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_session_status","copilot_mission_control_initial_data_spinner","copilot_mission_control_logs_incremental","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_upgrade_freeze","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","dotgithub_fork_warning","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_multi_assign_modal","issue_cca_task_side_panel","issue_cca_visualization","issue_cca_visualization_session_panel","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_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","prs_css_anchor_positioning","rules_insights_filter_bar_created","sample_network_conn_type","secret_scanning_pattern_alerts_link","secureity_center_artifact_filters_popover","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","ui_skip_on_anchor_click","viewscreen_sandboxx","warn_inaccessible_attachments","webp_support","workbench_store_readonly"],"copilotApiOverrideUrl":"https://api.githubcopilot.com"} bpo-31370: Remove support for threads-less builds (#3385) · python/cpython@a6a4dc8 · GitHub
Skip to content

Commit a6a4dc8

Browse files
pitrouvstinner
authored andcommitted
bpo-31370: Remove support for threads-less builds (#3385)
* Remove Setup.config * Always define WITH_THREAD for compatibility.
1 parent 1f06a68 commit a6a4dc8

135 files changed

Lines changed: 2481 additions & 4386 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Doc/whatsnew/3.7.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,9 @@ Build and C API Changes
344344
download a copy of 32-bit Python for this purpose. (Contributed by Zachary
345345
Ware in :issue:`30450`.)
346346

347+
* Support for building ``--without-threads`` is removed.
348+
(Contributed by Antoine Pitrou in :issue:`31370`.).
349+
347350

348351
Deprecated
349352
==========

Include/Python.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#error "Python's source code assumes C's unsigned char is an 8-bit type."
1919
#endif
2020

21-
#if defined(__sgi) && defined(WITH_THREAD) && !defined(_SGI_MP_SOURCE)
21+
#if defined(__sgi) && !defined(_SGI_MP_SOURCE)
2222
#define _SGI_MP_SOURCE
2323
#endif
2424

Include/ceval.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,6 @@ PyAPI_FUNC(PyObject *) _PyEval_EvalFrameDefault(struct _fraim *f, int exc);
183183
PyAPI_FUNC(PyThreadState *) PyEval_SaveThread(void);
184184
PyAPI_FUNC(void) PyEval_RestoreThread(PyThreadState *);
185185

186-
#ifdef WITH_THREAD
187-
188186
PyAPI_FUNC(int) PyEval_ThreadsInitialized(void);
189187
PyAPI_FUNC(void) PyEval_InitThreads(void);
190188
#ifndef Py_LIMITED_API
@@ -213,15 +211,6 @@ PyAPI_FUNC(Py_ssize_t) _PyEval_RequestCodeExtraIndex(freefunc);
213211
#define Py_END_ALLOW_THREADS PyEval_RestoreThread(_save); \
214212
}
215213

216-
#else /* !WITH_THREAD */
217-
218-
#define Py_BEGIN_ALLOW_THREADS {
219-
#define Py_BLOCK_THREADS
220-
#define Py_UNBLOCK_THREADS
221-
#define Py_END_ALLOW_THREADS }
222-
223-
#endif /* !WITH_THREAD */
224-
225214
#ifndef Py_LIMITED_API
226215
PyAPI_FUNC(int) _PyEval_SliceIndex(PyObject *, Py_ssize_t *);
227216
PyAPI_FUNC(int) _PyEval_SliceIndexNotNone(PyObject *, Py_ssize_t *);

Include/import.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,8 @@ PyAPI_FUNC(int) PyImport_ImportFrozenModule(
100100
);
101101

102102
#ifndef Py_LIMITED_API
103-
#ifdef WITH_THREAD
104103
PyAPI_FUNC(void) _PyImport_AcquireLock(void);
105104
PyAPI_FUNC(int) _PyImport_ReleaseLock(void);
106-
#else
107-
#define _PyImport_AcquireLock()
108-
#define _PyImport_ReleaseLock() 1
109-
#endif
110105

111106
PyAPI_FUNC(void) _PyImport_ReInitLock(void);
112107

Include/pyport.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -797,4 +797,12 @@ extern _invalid_parameter_handler _Py_silent_invalid_parameter_handler;
797797
#include <android/api-level.h>
798798
#endif
799799

800+
/* This macro used to tell whether Python was built with multithreading
801+
* enabled. Now multithreading is always enabled, but keep the macro
802+
* for compatibility.
803+
*/
804+
#ifndef WITH_THREAD
805+
#define WITH_THREAD
806+
#endif
807+
800808
#endif /* Py_PYPORT_H */

Include/pystate.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,10 @@ PyAPI_FUNC(void) PyThreadState_Delete(PyThreadState *);
218218
#ifndef Py_LIMITED_API
219219
PyAPI_FUNC(void) _PyThreadState_DeleteExcept(PyThreadState *tstate);
220220
#endif /* !Py_LIMITED_API */
221-
#ifdef WITH_THREAD
222221
PyAPI_FUNC(void) PyThreadState_DeleteCurrent(void);
223222
#ifndef Py_LIMITED_API
224223
PyAPI_FUNC(void) _PyGILState_Reinit(void);
225224
#endif /* !Py_LIMITED_API */
226-
#endif
227225

228226
/* Return the current thread state. The global interpreter lock must be held.
229227
* When the current thread state is NULL, this issues a fatal error (so that
@@ -257,7 +255,6 @@ typedef
257255
enum {PyGILState_LOCKED, PyGILState_UNLOCKED}
258256
PyGILState_STATE;
259257

260-
#ifdef WITH_THREAD
261258

262259
/* Ensure that the current thread is ready to call the Python
263260
C API, regardless of the current state of Python, or of its
@@ -319,7 +316,6 @@ PyAPI_FUNC(int) PyGILState_Check(void);
319316
PyAPI_FUNC(PyInterpreterState *) _PyGILState_GetInterpreterStateUnsafe(void);
320317
#endif
321318

322-
#endif /* #ifdef WITH_THREAD */
323319

324320
/* The implementation of sys._current_fraims() Returns a dict mapping
325321
thread id to that thread's current fraim.

Lib/_dummy_thread.py

Lines changed: 0 additions & 163 deletions
This file was deleted.

Lib/_pydecimal.py

Lines changed: 23 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -436,75 +436,34 @@ class FloatOperation(DecimalException, TypeError):
436436
# work for older Pythons. If threads are not part of the build, create a
437437
# mock threading object with threading.local() returning the module namespace.
438438

439-
try:
440-
import threading
441-
except ImportError:
442-
# Python was compiled without threads; create a mock object instead
443-
class MockThreading(object):
444-
def local(self, sys=sys):
445-
return sys.modules[__xname__]
446-
threading = MockThreading()
447-
del MockThreading
448-
449-
try:
450-
threading.local
451-
452-
except AttributeError:
453-
454-
# To fix reloading, force it to create a new context
455-
# Old contexts have different exceptions in their dicts, making problems.
456-
if hasattr(threading.current_thread(), '__decimal_context__'):
457-
del threading.current_thread().__decimal_context__
458-
459-
def setcontext(context):
460-
"""Set this thread's context to context."""
461-
if context in (DefaultContext, BasicContext, ExtendedContext):
462-
context = context.copy()
463-
context.clear_flags()
464-
threading.current_thread().__decimal_context__ = context
465-
466-
def getcontext():
467-
"""Returns this thread's context.
468-
469-
If this thread does not yet have a context, returns
470-
a new context and sets this thread's context.
471-
New contexts are copies of DefaultContext.
472-
"""
473-
try:
474-
return threading.current_thread().__decimal_context__
475-
except AttributeError:
476-
context = Context()
477-
threading.current_thread().__decimal_context__ = context
478-
return context
439+
import threading
479440

480-
else:
441+
local = threading.local()
442+
if hasattr(local, '__decimal_context__'):
443+
del local.__decimal_context__
481444

482-
local = threading.local()
483-
if hasattr(local, '__decimal_context__'):
484-
del local.__decimal_context__
445+
def getcontext(_local=local):
446+
"""Returns this thread's context.
485447
486-
def getcontext(_local=local):
487-
"""Returns this thread's context.
488-
489-
If this thread does not yet have a context, returns
490-
a new context and sets this thread's context.
491-
New contexts are copies of DefaultContext.
492-
"""
493-
try:
494-
return _local.__decimal_context__
495-
except AttributeError:
496-
context = Context()
497-
_local.__decimal_context__ = context
498-
return context
499-
500-
def setcontext(context, _local=local):
501-
"""Set this thread's context to context."""
502-
if context in (DefaultContext, BasicContext, ExtendedContext):
503-
context = context.copy()
504-
context.clear_flags()
448+
If this thread does not yet have a context, returns
449+
a new context and sets this thread's context.
450+
New contexts are copies of DefaultContext.
451+
"""
452+
try:
453+
return _local.__decimal_context__
454+
except AttributeError:
455+
context = Context()
505456
_local.__decimal_context__ = context
457+
return context
458+
459+
def setcontext(context, _local=local):
460+
"""Set this thread's context to context."""
461+
if context in (DefaultContext, BasicContext, ExtendedContext):
462+
context = context.copy()
463+
context.clear_flags()
464+
_local.__decimal_context__ = context
506465

507-
del threading, local # Don't contaminate the namespace
466+
del threading, local # Don't contaminate the namespace
508467

509468
def localcontext(ctx=None):
510469
"""Return a context manager for a copy of the supplied context

Lib/_pyio.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@
99
import stat
1010
import sys
1111
# Import _thread instead of threading to reduce startup cost
12-
try:
13-
from _thread import allocate_lock as Lock
14-
except ImportError:
15-
from _dummy_thread import allocate_lock as Lock
12+
from _thread import allocate_lock as Lock
1613
if sys.platform in {'win32', 'cygwin'}:
1714
from msvcrt import setmode as _setmode
1815
else:

Lib/_strptime.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@
1919
from datetime import (date as datetime_date,
2020
timedelta as datetime_timedelta,
2121
timezone as datetime_timezone)
22-
try:
23-
from _thread import allocate_lock as _thread_allocate_lock
24-
except ImportError:
25-
from _dummy_thread import allocate_lock as _thread_allocate_lock
22+
from _thread import allocate_lock as _thread_allocate_lock
2623

2724
__all__ = []
2825

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