How can I enforce the oder in `co_freevars`?

I’m trying to manipulate Python bytecode. I want the Python compiler compile source code in a way that preserves the order in co_freevars:

def helper_outer_function():
    data_ptr = None
    last_dim_size = None
    last_two_dims_size = None
    shape = None
    stride = None
    qkv_format = None
    def dummy1():
        nonlocal data_ptr, last_dim_size, last_two_dims_size, shape, stride, qkv_format
        # Access variables in the order they were declared
        _ = data_ptr
        _ = last_dim_size
        _ = last_two_dims_size
        _ = shape
        _ = stride
        _ = qkv_format
        print(data_ptr)
        print(last_dim_size)
        print(last_two_dims_size)
        print(shape)
        print(stride)
        print(qkv_format)
    dummy1()

Strangely, the co_freevars for dummy1 is

('data_ptr',
 'last_dim_size',
 'last_two_dims_size',
 'qkv_format',
 'shape',
 'stride')

, which is not the same order as I declear (nonlocal data_ptr, last_dim_size, last_two_dims_size, shape, stride, qkv_format).

Any idea to enforce the order?

According to

It seems indexes of free and cell var storage are always sorted.