God does not forgive that partners be set up with Him, and He forgives what is beside that for whom He wills. Whoever sets up partners with God has indeed invented a great sin.
Translation endnotes
[4:48] Before death, one may reform from associating partners to God (4:18; 40:66). A majority of the so-called Muslims, like a majority of Christians, have fallen into the trap of Shirk (associating other partners with God) by following the sectarian teachings concocted by their clergymen and scholars (9:31; 12:40; 42:21; 6:145-150). There is no contradiction between 4:48 and 4:153. The Quran contains numerous verses regarding polytheists or mushriks accepting the message of islam (42:25). Most of the supporters and companions of messengers and prophets were associating partners with God before they repented and accepted the message. For instance, the Quran informs us that even Muhammed was an idolater before he received revelation, and obviously, after his acknowledgement of the truth, he repented from his ignorance and God forgave him (40:66; 42:52; 93:7; 48:2).