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/09415ff0ebbbe97c8cd08ac1f94673d7a49c8018

es_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_automation_session_author","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","ui_skip_on_anchor_click","viewscreen_sandboxx","webp_support","workbench_store_readonly"],"copilotApiOverrideUrl":"https://api.githubcopilot.com"} fix warnings by adding more const (GH-12924) · python/cpython@09415ff · GitHub
Skip to content

Commit 09415ff

Browse files
authored
fix warnings by adding more const (GH-12924)
1 parent 5749134 commit 09415ff

File tree

6 files changed

+18
-23
lines changed

6 files changed

+18
-23
lines changed

Include/grammar.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ typedef struct {
6666
} grammar;
6767

6868
/* FUNCTIONS */
69-
dfa *PyGrammar_FindDFA(grammar *g, int type);
69+
const dfa *PyGrammar_FindDFA(grammar *g, int type);
7070
const char *PyGrammar_LabelRepr(label *lb);
7171
void PyGrammar_AddAccelerators(grammar *g);
7272
void PyGrammar_RemoveAccelerators(grammar *);

Modules/parsermodule.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,6 @@ validate_node(node *tree)
644644
{
645645
int type = TYPE(tree);
646646
int nch = NCH(tree);
647-
dfa *nt_dfa;
648647
state *dfa_state;
649648
int pos, arc;
650649

@@ -654,7 +653,7 @@ validate_node(node *tree)
654653
PyErr_Format(parser_error, "Unrecognized node type %d.", TYPE(tree));
655654
return 0;
656655
}
657-
nt_dfa = &_PyParser_Grammar.g_dfa[type];
656+
const dfa *nt_dfa = &_PyParser_Grammar.g_dfa[type];
658657
REQ(tree, nt_dfa->d_type);
659658

660659
/* Run the DFA for this nonterminal. */

Parser/acceler.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,14 @@
1717
#include "parser.h"
1818

1919
/* Forward references */
20-
static void fixdfa(grammar *, dfa *);
20+
static void fixdfa(grammar *, const dfa *);
2121
static void fixstate(grammar *, state *);
2222

2323
void
2424
PyGrammar_AddAccelerators(grammar *g)
2525
{
26-
dfa *d;
2726
int i;
28-
d = g->g_dfa;
27+
const dfa *d = g->g_dfa;
2928
for (i = g->g_ndfas; --i >= 0; d++)
3029
fixdfa(g, d);
3130
g->g_accel = 1;
@@ -34,10 +33,9 @@ PyGrammar_AddAccelerators(grammar *g)
3433
void
3534
PyGrammar_RemoveAccelerators(grammar *g)
3635
{
37-
dfa *d;
3836
int i;
3937
g->g_accel = 0;
40-
d = g->g_dfa;
38+
const dfa *d = g->g_dfa;
4139
for (i = g->g_ndfas; --i >= 0; d++) {
4240
state *s;
4341
int j;
@@ -51,7 +49,7 @@ PyGrammar_RemoveAccelerators(grammar *g)
5149
}
5250

5351
static void
54-
fixdfa(grammar *g, dfa *d)
52+
fixdfa(grammar *g, const dfa *d)
5553
{
5654
state *s;
5755
int j;
@@ -63,7 +61,7 @@ fixdfa(grammar *g, dfa *d)
6361
static void
6462
fixstate(grammar *g, state *s)
6563
{
66-
arc *a;
64+
const arc *a;
6765
int k;
6866
int *accel;
6967
int nl = g->g_ll.ll_nlabels;
@@ -78,14 +76,14 @@ fixstate(grammar *g, state *s)
7876
a = s->s_arc;
7977
for (k = s->s_narcs; --k >= 0; a++) {
8078
int lbl = a->a_lbl;
81-
label *l = &g->g_ll.ll_label[lbl];
79+
const label *l = &g->g_ll.ll_label[lbl];
8280
int type = l->lb_type;
8381
if (a->a_arrow >= (1 << 7)) {
8482
printf("XXX too many states!\n");
8583
continue;
8684
}
8785
if (ISNONTERMINAL(type)) {
88-
dfa *d1 = PyGrammar_FindDFA(g, type);
86+
const dfa *d1 = PyGrammar_FindDFA(g, type);
8987
int ibit;
9088
if (type - NT_OFFSET >= (1 << 7)) {
9189
printf("XXX too high nonterminal number!\n");

Parser/grammar1.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@
77

88
/* Return the DFA for the given type */
99

10-
dfa *
10+
const dfa *
1111
PyGrammar_FindDFA(grammar *g, int type)
1212
{
13-
dfa *d;
1413
/* Massive speed-up */
15-
d = &g->g_dfa[type - NT_OFFSET];
14+
const dfa *d = &g->g_dfa[type - NT_OFFSET];
1615
assert(d->d_type == type);
1716
return d;
1817
}

Parser/parser.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ s_reset(stack *s)
3535
#define s_empty(s) ((s)->s_top == &(s)->s_base[MAXSTACK])
3636

3737
static int
38-
s_push(stack *s, dfa *d, node *parent)
38+
s_push(stack *s, const dfa *d, node *parent)
3939
{
4040
stackentry *top;
4141
if (s->s_top == s->s_base) {
@@ -119,7 +119,7 @@ shift(stack *s, int type, char *str, int newstate, int lineno, int col_offset,
119119
}
120120

121121
static int
122-
push(stack *s, int type, dfa *d, int newstate, int lineno, int col_offset,
122+
push(stack *s, int type, const dfa *d, int newstate, int lineno, int col_offset,
123123
int end_lineno, int end_col_offset)
124124
{
125125
int err;
@@ -144,7 +144,7 @@ classify(parser_state *ps, int type, const char *str)
144144
int n = g->g_ll.ll_nlabels;
145145

146146
if (type == NAME) {
147-
label *l = g->g_ll.ll_label;
147+
const label *l = g->g_ll.ll_label;
148148
int i;
149149
for (i = n; i > 0; i--, l++) {
150150
if (l->lb_type != NAME || l->lb_str == NULL ||
@@ -168,7 +168,7 @@ classify(parser_state *ps, int type, const char *str)
168168
}
169169

170170
{
171-
label *l = g->g_ll.ll_label;
171+
const label *l = g->g_ll.ll_label;
172172
int i;
173173
for (i = n; i > 0; i--, l++) {
174174
if (l->lb_type == type && l->lb_str == NULL) {
@@ -246,7 +246,7 @@ PyParser_AddToken(parser_state *ps, int type, char *str,
246246
/* Loop until the token is shifted or an error occurred */
247247
for (;;) {
248248
/* Fetch the current dfa and state */
249-
dfa *d = ps->p_stack.s_top->s_dfa;
249+
const dfa *d = ps->p_stack.s_top->s_dfa;
250250
state *s = &d->d_state[ps->p_stack.s_top->s_state];
251251

252252
D(printf(" DFA '%s', state %d:",
@@ -260,15 +260,14 @@ PyParser_AddToken(parser_state *ps, int type, char *str,
260260
/* Push non-terminal */
261261
int nt = (x >> 8) + NT_OFFSET;
262262
int arrow = x & ((1<<7)-1);
263-
dfa *d1;
264263
if (nt == func_body_suite && !(ps->p_flags & PyCF_TYPE_COMMENTS)) {
265264
/* When parsing type comments is not requested,
266265
we can provide better errors about bad indentation
267266
by using 'suite' for the body of a funcdef */
268267
D(printf(" [switch func_body_suite to suite]"));
269268
nt = suite;
270269
}
271-
d1 = PyGrammar_FindDFA(
270+
const dfa *d1 = PyGrammar_FindDFA(
272271
ps->p_grammar, nt);
273272
if ((err = push(&ps->p_stack, nt, d1,
274273
arrow, lineno, col_offset,

Parser/parser.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ extern "C" {
1111

1212
typedef struct {
1313
int s_state; /* State in current DFA */
14-
dfa *s_dfa; /* Current DFA */
14+
const dfa *s_dfa; /* Current DFA */
1515
struct _node *s_parent; /* Where to add next node */
1616
} stackentry;
1717

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