FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-32150: Expand tabs to spaces in C files. by serhiy-storchaka · Pull Request #4583 · python/cpython · GitHub

Repository navigation

bpo-32150: Expand tabs to spaces in C files. - #4583

Merged
serhiy-storchaka merged 2 commits into
python:masterfrom
serhiy-storchaka:expand-tabs
Nov 28, 2017
Merged

serhiy-storchaka merged 2 commits into
python:masterfrom
serhiy-storchaka:expand-tabs

Conversation

serhiy-storchaka commented Nov 27, 2017 •
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Member

Tabs in C files add a noise in the diff if the committer uses an editor which don't preserve tabs (see for example #4390). This can hide semantic changes in tab expansion changes. It is better to expand all tabs to spaces in the single commit that doesn't do anything other.

https://bugs.python.org/issue32150

Copy link
Copy Markdown
Member

Where's the bpo issue?

Copy link
Copy Markdown
Member Author

I haven't created a bpo issue. Do you think that this is necessary?

gvanrossum commented Nov 27, 2017 via email

Copy link
Copy Markdown
Member

serhiy-storchaka changed the title Expand tabs to spaces in C files. bpo-32150: Expand tabs to spaces in C files. Nov 27, 2017

serhiy-storchaka left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Commented issues in the current code fixed by this PR.

Comment thread Include/bitset.h
#define NBYTES(nbits) (((nbits) + BITSPERBYTE - 1) / BITSPERBYTE)

#define BIT2BYTE(ibit) ((ibit) / BITSPERBYTE)
#define BIT2SHIFT(ibit) ((ibit) % BITSPERBYTE)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Here tabs make the view on GitHub uglier. See at left side.

Comment thread Include/bytesobject.h
int use_bytearray);
#endif
PyAPI_FUNC(PyObject *) PyBytes_DecodeEscape(const char *, Py_ssize_t,
const char *, Py_ssize_t,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Wrong alignment due to tabs.

Comment thread Include/bytesobject.h

/* Flags used by string formatting */
#define F_LJUST (1<<0)
#define F_SIGN (1<<1)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Mixed tabs and spaces make worser a view on GitHub.

Comment thread Include/cellobject.h
#endif

typedef struct {
PyObject_HEAD

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Too larger indent.

Comment thread Include/classobject.h
#define PyMethod_GET_FUNCTION(meth) \
(((PyMethodObject *)meth) -> im_func)
#define PyMethod_GET_SELF(meth) \
(((PyMethodObject *)meth) -> im_self)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Mixed tabs and spaces (compare with lines above).

Comment thread Python/getplatform.c
const char *
Py_GetPlatform(void)
{
return PLATFORM;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Too large indent.

Comment thread Python/getversion.c
const char *
Py_GetVersion(void)
{
static char version[250];

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Too large indent.

Comment thread Python/pyfpe.c
double
PyFPE_dummy(void *dummy)
{
return 1.0;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Too large indent.

Comment thread Python/pystrhex.c
if (return_bytes) {
/* If _PyBytes_FromSize() were public we could avoid malloc+copy. */
retbuf = (Py_UCS1*) PyMem_Malloc(arglen*2);
if (!retbuf)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Mixed tabs and spaces.

Comment thread Python/strdup.c
char *
strdup(const char *str)
{
if (str != NULL) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Too large indent.

Comment thread Doc/includes/shoddy.c Outdated
{"increment", (PyCFunction)Shoddy_increment, METH_NOARGS,
PyDoc_STR("increment state counter")},
{NULL, NULL},
{NULL, NULL},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This is part of the documentation. Maybe use a single space? The tab doesn’t seem to align with anything.

Or even drop the second NULL. Other PyMethodDef arrays on the page have a single NULL. The other three fields get zeroed implicitly, and it looks like the first field (ml_name) is the one that is checked for NULL.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I prefer to drop the second NULL.

serhiy-storchaka merged commit 598ceae into python:master Nov 28, 2017
serhiy-storchaka deleted the expand-tabs branch November 28, 2017 15:56
Comment thread Include/patchlevel.h
#define PY_MICRO_VERSION 0
#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_ALPHA
#define PY_RELEASE_SERIAL 2

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Note that the version constants are automatically generated by the release management tool, https://github.com/python/release-tools/blob/master/release.py, so that will probably need to be modified to handle spaces instead of tabs and any changes there need to be able to continue to handle patchlevel.h in older release cycles.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Oh, my bad.

I have created a PR for the release management tool: python/release-tools#2 .

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants


Back | FazBrowse Home | New Git URL