bpo-38304: Remove PyConfig.struct_size (GH-16500) · python/cpython@bdace21 (original) (raw)

`@@ -194,25 +194,18 @@ PyPreConfig

`

194

194

` * Configure the LC_CTYPE locale

`

195

195

` * Set the UTF-8 mode

`

196

196

``

197

``

`` -

The :c:member:struct_size field must be explicitly initialized to

``

198

``


 ``sizeof(PyPreConfig)``.

199

``

-

200

197

` Function to initialize a preconfiguration:

`

201

198

``

202

``

`-

.. c:function:: PyStatus PyPreConfig_InitIsolatedConfig(PyPreConfig *preconfig)

`

``

199

`+

.. c:function:: void PyPreConfig_InitIsolatedConfig(PyPreConfig *preconfig)

`

203

200

``

204

201

`` Initialize the preconfiguration with :ref:`Python Configuration

``

205

202

`` `.

``

206

203

``

207

``

`-

.. c:function:: PyStatus PyPreConfig_InitPythonConfig(PyPreConfig *preconfig)

`

``

204

`+

.. c:function:: void PyPreConfig_InitPythonConfig(PyPreConfig *preconfig)

`

208

205

``

209

206

`` Initialize the preconfiguration with :ref:`Isolated Configuration

``

210

207

`` `.

``

211

208

``

212

``

`-

The caller of these functions is responsible to handle exceptions (error or

`

213

``

`` -

exit) using :c:func:PyStatus_Exception and

``

214

``

`` -

:c:func:Py_ExitStatusException.

``

215

``

-

216

209

` Structure fields:

`

217

210

``

218

211

` .. c:member:: int allocator

`

`@@ -274,13 +267,6 @@ PyPreConfig

`

274

267

` same way the regular Python parses command line arguments: see

`

275

268

`` :ref:Command Line Arguments <using-on-cmdline>.

``

276

269

``

277

``

`-

.. c:member:: size_t struct_size

`

278

``

-

279

``

`-

Size of the structure in bytes: must be initialized to

`

280

``


 ``sizeof(PyPreConfig)``.

281

``

-

282

``

`-

Field used for API and ABI compatibility.

`

283

``

-

284

270

` .. c:member:: int use_environment

`

285

271

``

286

272

`` See :c:member:PyConfig.use_environment.

``

`@@ -332,12 +318,7 @@ Example using the preinitialization to enable the UTF-8 Mode::

`

332

318

``

333

319

` PyStatus status;

`

334

320

` PyPreConfig preconfig;

`

335

``

`-

preconfig.struct_size = sizeof(PyPreConfig);

`

336

``

-

337

``

`-

status = PyPreConfig_InitPythonConfig(&preconfig);

`

338

``

`-

if (PyStatus_Exception(status)) {

`

339

``

`-

Py_ExitStatusException(status);

`

340

``

`-

}

`

``

321

`+

PyPreConfig_InitPythonConfig(&preconfig);

`

341

322

``

342

323

` preconfig.utf8_mode = 1;

`

343

324

``

`@@ -360,9 +341,6 @@ PyConfig

`

360

341

``

361

342

` Structure containing most parameters to configure Python.

`

362

343

``

363

``

`` -

The :c:member:struct_size field must be explicitly initialized to

``

364

``


 ``sizeof(PyConfig)``.

365

``

-

366

344

` Structure methods:

`

367

345

``

368

346

` .. c:function:: PyStatus PyConfig_InitPythonConfig(PyConfig *config)

`

`@@ -679,13 +657,6 @@ PyConfig

`

679

657

`` Encoding and encoding errors of :data:sys.stdin, :data:sys.stdout and

``

680

658

`` :data:sys.stderr.

``

681

659

``

682

``

`-

.. c:member:: size_t struct_size

`

683

``

-

684

``

`-

Size of the structure in bytes: must be initialized to

`

685

``


 ``sizeof(PyConfig)``.

686

``

-

687

``

`-

Field used for API and ABI compatibility.

`

688

``

-

689

660

` .. c:member:: int tracemalloc

`

690

661

``

691

662

`` If non-zero, call :func:tracemalloc.start at startup.

``

`@@ -754,7 +725,6 @@ Example setting the program name::

`

754

725

` {

`

755

726

` PyStatus status;

`

756

727

` PyConfig config;

`

757

``

`-

config.struct_size = sizeof(PyConfig);

`

758

728

``

759

729

` status = PyConfig_InitPythonConfig(&config);

`

760

730

` if (PyStatus_Exception(status)) {

`

`@@ -787,7 +757,6 @@ configuration, and then override some parameters::

`

787

757

` {

`

788

758

` PyStatus status;

`

789

759

` PyConfig config;

`

790

``

`-

config.struct_size = sizeof(PyConfig);

`

791

760

``

792

761

` status = PyConfig_InitPythonConfig(&config);

`

793

762

` if (PyStatus_Exception(status)) {

`

`@@ -875,7 +844,6 @@ Example of customized Python always running in isolated mode::

`

875

844

` {

`

876

845

` PyStatus status;

`

877

846

` PyConfig config;

`

878

``

`-

config.struct_size = sizeof(PyConfig);

`

879

847

``

880

848

` status = PyConfig_InitPythonConfig(&config);

`

881

849

`if (PyStatus_Exception(status)) {

`

`@@ -1067,7 +1035,6 @@ phases::

`

1067

1035

` {

`

1068

1036

` PyStatus status;

`

1069

1037

` PyConfig config;

`

1070

``

`-

config.struct_size = sizeof(PyConfig);

`

1071

1038

``

1072

1039

` status = PyConfig_InitPythonConfig(&config);

`

1073

1040

` if (PyStatus_Exception(status)) {

`