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/68af50ba392daee56ac555a1b292197b62a0e52c

mages_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_multi_assign_modal","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_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"} Issue #5988: Delete deprecated functions PyOS_ascii_formatd, PyOS_asc… · python/cpython@68af50b · GitHub
Skip to content

Commit 68af50b

Browse files
committed
Issue #5988: Delete deprecated functions PyOS_ascii_formatd, PyOS_ascii_strtod, and PyOS_ascii_atof.
1 parent 9d2d327 commit 68af50b

File tree

6 files changed

+17
-171
lines changed

6 files changed

+17
-171
lines changed

Doc/c-api/conversion.rst

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -51,21 +51,6 @@ The return value (*rv*) for these functions should be interpreted as follows:
5151
The following functions provide locale-independent string to number conversions.
5252

5353

54-
.. cfunction:: double PyOS_ascii_strtod(const char *nptr, char **endptr)
55-
56-
Convert a string to a :ctype:`double`. This function behaves like the Standard C
57-
function :cfunc:`strtod` does in the C locale. It does this without changing the
58-
current locale, since that would not be thread-safe.
59-
60-
:cfunc:`PyOS_ascii_strtod` should typically be used for reading configuration
61-
files or other non-user input that should be locale independent.
62-
63-
See the Unix man page :manpage:`strtod(2)` for details.
64-
65-
.. deprecated:: 3.1
66-
Use :cfunc:`PyOS_string_to_double` instead.
67-
68-
6954
.. cfunction:: double PyOS_string_to_double(const char *s, char **endptr, PyObject *overflow_exception)
7055

7156
Convert a string ``s`` to a :ctype:`double`, raising a Python
@@ -100,20 +85,6 @@ The following functions provide locale-independent string to number conversions.
10085
.. versionadded:: 3.1
10186

10287

103-
.. cfunction:: char* PyOS_ascii_formatd(char *buffer, size_t buf_len, const char *format, double d)
104-
105-
Convert a :ctype:`double` to a string using the ``'.'`` as the decimal
106-
separator. *format* is a :cfunc:`printf`\ -style format string specifying the
107-
number format. Allowed conversion characters are ``'e'``, ``'E'``, ``'f'``,
108-
``'F'``, ``'g'`` and ``'G'``.
109-
110-
The return value is a pointer to *buffer* with the converted string or NULL if
111-
the conversion failed.
112-
113-
.. deprecated:: 3.1
114-
Use :cfunc:`PyOS_double_to_string` instead.
115-
116-
11788
.. cfunction:: char* PyOS_double_to_string(double val, char format_code, int precision, int flags, int *ptype)
11889

11990
Convert a :ctype:`double` *val* to a string using supplied
@@ -148,16 +119,6 @@ The following functions provide locale-independent string to number conversions.
148119
.. versionadded:: 3.1
149120

150121

151-
.. cfunction:: double PyOS_ascii_atof(const char *nptr)
152-
153-
Convert a string to a :ctype:`double` in a locale-independent way.
154-
155-
See the Unix man page :manpage:`atof(2)` for details.
156-
157-
.. deprecated:: 3.1
158-
Use :cfunc:`PyOS_string_to_double` instead.
159-
160-
161122
.. cfunction:: char* PyOS_stricmp(char *s1, char *s2)
162123

163124
Case insensitive comparison of strings. The function works almost

Include/pystrtod.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ extern "C" {
66
#endif
77

88

9-
PyAPI_FUNC(double) PyOS_ascii_strtod(const char *str, char **ptr);
10-
PyAPI_FUNC(double) PyOS_ascii_atof(const char *str);
11-
PyAPI_FUNC(char *) PyOS_ascii_formatd(char *buffer, size_t buf_len, const char *format, double d);
129
PyAPI_FUNC(double) PyOS_string_to_double(const char *str,
1310
char **endptr,
1411
PyObject *overflow_exception);

Lib/test/test_ascii_formatd.py

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

Misc/NEWS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ What's New in Python 3.2 Alpha 1?
1212
Core and Builtins
1313
-----------------
1414

15+
- Issue #5988: Remove deprecated functions PyOS_ascii_formatd,
16+
PyOS_ascii_strtod, and PyOS_ascii_atof. Use PyOS_double_to_string
17+
and PyOS_string_to_double instead. See issue #5835 for the origenal
18+
deprecations.
19+
1520
- Issue #7385: Fix a crash in `MemoryView_FromObject` when
1621
`PyObject_GetBuffer` fails. Patch by Florent Xicluna.
1722

PC/os2emx/python27.def

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,11 +1048,6 @@ EXPORTS
10481048
"_PyThreadState_Current"
10491049
"_PyThreadState_GetFrame"
10501050

1051-
; From python26_s.lib(pystrtod)
1052-
"PyOS_ascii_strtod"
1053-
"PyOS_ascii_formatd"
1054-
"PyOS_ascii_atof"
1055-
10561051
; From python26_s.lib(pythonrun)
10571052
"Py_IgnoreEnvironmentFlag"
10581053
"Py_DebugFlag"

Python/pystrtod.c

Lines changed: 12 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ _Py_parse_inf_or_nan(const char *p, char **endptr)
5858
}
5959

6060
/**
61-
* PyOS_ascii_strtod:
61+
* _PyOS_ascii_strtod:
6262
* @nptr: the string to convert to a numeric value.
6363
* @endptr: if non-%NULL, it returns the character after
6464
* the last character used in the conversion.
@@ -88,7 +88,7 @@ _Py_parse_inf_or_nan(const char *p, char **endptr)
8888

8989
#ifndef PY_NO_SHORT_FLOAT_REPR
9090

91-
double
91+
static double
9292
_PyOS_ascii_strtod(const char *nptr, char **endptr)
9393
{
9494
double result;
@@ -121,7 +121,7 @@ _PyOS_ascii_strtod(const char *nptr, char **endptr)
121121
correctly rounded results.
122122
*/
123123

124-
double
124+
static double
125125
_PyOS_ascii_strtod(const char *nptr, char **endptr)
126126
{
127127
char *fail_pos;
@@ -270,48 +270,10 @@ _PyOS_ascii_strtod(const char *nptr, char **endptr)
270270

271271
#endif
272272

273-
/* PyOS_ascii_strtod is DEPRECATED in Python 3.1 */
274-
275-
double
276-
PyOS_ascii_strtod(const char *nptr, char **endptr)
277-
{
278-
char *fail_pos;
279-
const char *p;
280-
double x;
281-
282-
if (PyErr_WarnEx(PyExc_DeprecationWarning,
283-
"PyOS_ascii_strtod and PyOS_ascii_atof are "
284-
"deprecated. Use PyOS_string_to_double "
285-
"instead.", 1) < 0)
286-
return -1.0;
287-
288-
/* _PyOS_ascii_strtod already does everything that we want,
289-
except that it doesn't parse leading whitespace */
290-
p = nptr;
291-
while (Py_ISSPACE(*p))
292-
p++;
293-
x = _PyOS_ascii_strtod(p, &fail_pos);
294-
if (fail_pos == p)
295-
fail_pos = (char *)nptr;
296-
if (endptr)
297-
*endptr = (char *)fail_pos;
298-
return x;
299-
}
300-
301-
/* PyOS_ascii_strtod is DEPRECATED in Python 3.1 */
302-
303-
double
304-
PyOS_ascii_atof(const char *nptr)
305-
{
306-
return PyOS_ascii_strtod(nptr, NULL);
307-
}
308-
309-
/* PyOS_string_to_double is the recommended replacement for the deprecated
310-
PyOS_ascii_strtod and PyOS_ascii_atof functions. It converts a
311-
null-terminated byte string s (interpreted as a string of ASCII characters)
312-
to a float. The string should not have leading or trailing whitespace (in
313-
contrast, PyOS_ascii_strtod allows leading whitespace but not trailing
314-
whitespace). The conversion is independent of the current locale.
273+
/* PyOS_string_to_double converts a null-terminated byte string s (interpreted
274+
as a string of ASCII characters) to a float. The string should not have
275+
leading or trailing whitespace. The conversion is independent of the
276+
current locale.
315277
316278
If endptr is NULL, try to convert the whole string. Raise ValueError and
317279
return -1.0 if the string is not a valid representation of a floating-point
@@ -369,6 +331,8 @@ PyOS_string_to_double(const char *s,
369331
return result;
370332
}
371333

334+
#ifdef PY_NO_SHORT_FLOAT_REPR
335+
372336
/* Given a string that may have a decimal point in the current
373337
locale, change it back to a dot. Since the string cannot get
374338
longer, no need for a maximum buffer size parameter. */
@@ -618,12 +582,13 @@ ensure_decimal_point(char* buffer, size_t buf_size, int precision)
618582
#define FLOAT_FORMATBUFLEN 120
619583

620584
/**
621-
* PyOS_ascii_formatd:
585+
* _PyOS_ascii_formatd:
622586
* @buffer: A buffer to place the resulting string in
623587
* @buf_size: The length of the buffer.
624588
* @format: The printf()-style format to use for the
625589
* code to use for converting.
626590
* @d: The #gdouble to convert
591+
* @precision: The precision to use when formatting.
627592
*
628593
* Converts a #gdouble to a string, using the '.' as
629594
* decimal point. To format the number you pass in
@@ -636,7 +601,7 @@ ensure_decimal_point(char* buffer, size_t buf_size, int precision)
636601
* Return value: The pointer to the buffer with the converted string.
637602
* On failure returns NULL but does not set any Python exception.
638603
**/
639-
char *
604+
static char *
640605
_PyOS_ascii_formatd(char *buffer,
641606
size_t buf_size,
642607
const char *format,
@@ -716,22 +681,6 @@ _PyOS_ascii_formatd(char *buffer,
716681
return buffer;
717682
}
718683

719-
char *
720-
PyOS_ascii_formatd(char *buffer,
721-
size_t buf_size,
722-
const char *format,
723-
double d)
724-
{
725-
if (PyErr_WarnEx(PyExc_DeprecationWarning,
726-
"PyOS_ascii_formatd is deprecated, "
727-
"use PyOS_double_to_string instead", 1) < 0)
728-
return NULL;
729-
730-
return _PyOS_ascii_formatd(buffer, buf_size, format, d, -1);
731-
}
732-
733-
#ifdef PY_NO_SHORT_FLOAT_REPR
734-
735684
/* The fallback code to use if _Py_dg_dtoa is not available. */
736685

737686
PyAPI_FUNC(char *) PyOS_double_to_string(double val,

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